Compare commits
36 Commits
6bb9d932b8
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ad7835f0db | |||
| b2e9597839 | |||
| 95d9432298 | |||
| 689f9ee51c | |||
| 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>
|
<version>4.4.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.paho</groupId>
|
||||||
|
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||||
|
<version>1.2.5</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ package com.njcn.csdevice.api;
|
|||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.fallback.CsCommTerminalFeignClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsCommTerminalFeignClientFallbackFactory;
|
||||||
import com.njcn.csdevice.api.fallback.CsDeviceUserClientFallbackFactory;
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
|
||||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -31,4 +30,7 @@ public interface CsCommTerminalFeignClient {
|
|||||||
|
|
||||||
@GetMapping("getPqUserIdsByUser")
|
@GetMapping("getPqUserIdsByUser")
|
||||||
HttpResult<List<String>> getPqUserIdsByUser(@RequestParam("userId") String userId);
|
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.po.CsEdDataPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
@@ -22,4 +24,7 @@ public interface CsEdDataFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/getAll")
|
@PostMapping("/getAll")
|
||||||
HttpResult<List<CsEdDataPO>> getAll(@RequestParam("devType") String devType);
|
HttpResult<List<CsEdDataPO>> getAll(@RequestParam("devType") String devType);
|
||||||
|
|
||||||
|
@GetMapping("/getById")
|
||||||
|
HttpResult<CsEdDataPO> getById(@RequestParam("id") String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
|
||||||
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
@@ -75,9 +72,9 @@ public interface CsLineFeignClient {
|
|||||||
@PostMapping("/getOverLimitDataByIds")
|
@PostMapping("/getOverLimitDataByIds")
|
||||||
HttpResult<List<Overlimit>> getOverLimitData(@RequestBody List<String> ids);
|
HttpResult<List<Overlimit>> getOverLimitData(@RequestBody List<String> ids);
|
||||||
|
|
||||||
@PostMapping("/getLineBySensitiveUser")
|
@PostMapping("/getDevBySensitiveUser")
|
||||||
@ApiOperation("根据敏感用户查询监测点")
|
@ApiOperation("根据敏感用户查询装置")
|
||||||
HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list);
|
HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(@RequestBody List<String> list);
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
HttpResult<List<CsLinePO>> list(@RequestBody CsLinePO param);
|
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.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.fallback.CsLineTopologyClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsLineTopologyClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -19,4 +22,8 @@ public interface CsLineTopologyFeignClient {
|
|||||||
@PostMapping("/addList")
|
@PostMapping("/addList")
|
||||||
HttpResult<String> addList(@RequestBody List<AppLineTopologyDiagramPO> list);
|
HttpResult<String> addList(@RequestBody List<AppLineTopologyDiagramPO> list);
|
||||||
|
|
||||||
|
@PostMapping("/queryTopologyDiagram")
|
||||||
|
@ApiOperation("查询装置拓扑图")
|
||||||
|
HttpResult<AppTopologyDiagramVO> queryTopologyDiagram(@RequestParam(value="devId") String devId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.fallback.CsUpgradeLogsClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-23
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csUpgradeLogs", fallbackFactory = CsUpgradeLogsClientFallbackFactory.class,contextId = "csSoftInfo")
|
||||||
|
public interface CsUpgradeLogsFeignClient {
|
||||||
|
@PostMapping("/add")
|
||||||
|
HttpResult add(@RequestBody CsUpgradeLogs csUpgradeLogs);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.ServerInfo;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.fallback.DeviceMessageClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.DeviceMessageClientFallbackFactory;
|
||||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||||
|
import com.njcn.csdevice.param.LineInfoParam;
|
||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
@@ -29,6 +30,6 @@ public interface DeviceMessageFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/getLineInfo")
|
@PostMapping("/getLineInfo")
|
||||||
@ApiOperation("获取监测点信息")
|
@ApiOperation("获取监测点信息")
|
||||||
HttpResult<String> getLineInfo(@RequestParam("id") String id);
|
HttpResult<String> getLineInfo(@RequestBody LineInfoParam param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.njcn.csdevice.api;
|
|
||||||
|
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import com.njcn.csdevice.api.fallback.SmsSendClientFallbackFactory;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xy
|
|
||||||
*/
|
|
||||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/sms", fallbackFactory = SmsSendClientFallbackFactory.class,contextId = "sms")
|
|
||||||
public interface SmsSendFeignClient {
|
|
||||||
|
|
||||||
@PostMapping("/send/simple")
|
|
||||||
@ApiOperation("发送短信(简化参数)")
|
|
||||||
HttpResult<String> sendSmsSimple(@RequestParam("receiver") String receiver
|
|
||||||
, @RequestParam("content") String content
|
|
||||||
, @RequestParam("messageType") String messageType);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -51,6 +52,12 @@ public class CsCommTerminalFeignClientFallbackFactory implements FallbackFactory
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据登录用户id获取电能质量用户id集合",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据登录用户id获取电能质量用户id集合",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
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());
|
log.error("{}异常,降级处理,异常为:{}","根据装置型号获取装置类型",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<CsEdDataPO> getById(String id) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据id获取装置类型",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
@@ -117,7 +118,7 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(List<String> list) {
|
public HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(List<String> list) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","根据敏感用户查询监测点异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据敏感用户查询监测点异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.CsLineTopologyFeignClient;
|
import com.njcn.csdevice.api.CsLineTopologyFeignClient;
|
||||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -33,6 +34,12 @@ public class CsLineTopologyClientFallbackFactory implements FallbackFactory<CsLi
|
|||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<AppTopologyDiagramVO> queryTopologyDiagram(String devId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","查询装置拓扑图异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,30 +3,32 @@ package com.njcn.csdevice.api.fallback;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.SmsSendFeignClient;
|
import com.njcn.csdevice.api.CsUpgradeLogsFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author caozehui
|
||||||
|
* @data 2026-04-23
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class SmsSendClientFallbackFactory implements FallbackFactory<SmsSendFeignClient> {
|
public class CsUpgradeLogsClientFallbackFactory implements FallbackFactory<CsUpgradeLogsFeignClient> {
|
||||||
@Override
|
@Override
|
||||||
public SmsSendFeignClient create(Throwable cause) {
|
public CsUpgradeLogsFeignClient create(Throwable cause) {
|
||||||
//判断抛出异常是否为解码器抛出的业务异常
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
if (cause.getCause() instanceof BusinessException) {
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
BusinessException businessException = (BusinessException) cause.getCause();
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
}
|
}
|
||||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
return new SmsSendFeignClient() {
|
|
||||||
|
|
||||||
|
return new CsUpgradeLogsFeignClient() {
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<String> sendSmsSimple(String receiver, String content, String messageType) {
|
public HttpResult add(CsUpgradeLogs csUpgradeLogs) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","发送短信(简化参数)数据异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}", "新增升级日志异常", cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.DeviceMessageFeignClient;
|
import com.njcn.csdevice.api.DeviceMessageFeignClient;
|
||||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||||
|
import com.njcn.csdevice.param.LineInfoParam;
|
||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -41,7 +42,7 @@ public class DeviceMessageClientFallbackFactory implements FallbackFactory<Devic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<String> getLineInfo(String id) {
|
public HttpResult<String> getLineInfo(LineInfoParam param) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","获取监测点信息数据异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","获取监测点信息数据异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,7 @@ public class IcdBzParam implements Serializable {
|
|||||||
@ApiModelProperty("结束时间")
|
@ApiModelProperty("结束时间")
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("补召类型 0:稳态 1:暂态事件 2:波形)")
|
||||||
|
private Integer bzType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.csdevice.param;
|
||||||
|
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LineInfoParam {
|
||||||
|
|
||||||
|
@ApiModelProperty("nDid")
|
||||||
|
private String nDid;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点集合")
|
||||||
|
List<CsLinePO> list;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.njcn.csdevice.pojo.dto;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author caozehui
|
|
||||||
* @data 2026-03-31
|
|
||||||
*/
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统凭证请求 DTO
|
|
||||||
*
|
|
||||||
* @author msgpush
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class CredentialReqDTO implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上游系统名称
|
|
||||||
*/
|
|
||||||
@NotEmpty(message = "上游系统名称不能为空")
|
|
||||||
private String systemName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 密钥(用于生成凭证)
|
|
||||||
*/
|
|
||||||
@NotEmpty(message = "密钥不能为空")
|
|
||||||
private String secretKey;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -115,4 +115,24 @@ public class CsEquipmentDeliveryDTO {
|
|||||||
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||||
*/
|
*/
|
||||||
private String devLogLevel;
|
private String devLogLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备软件信息id
|
||||||
|
*/
|
||||||
|
private String softinfoId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 治理方法
|
||||||
|
*/
|
||||||
|
private String governMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感用户id
|
||||||
|
*/
|
||||||
|
private String monitorUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 治理类型(稳态:harmonic 暂态:event)
|
||||||
|
*/
|
||||||
|
private String governType;
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,12 @@ public class CsLineDTO implements Serializable {
|
|||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 装置id
|
* 装置名称
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置类型
|
||||||
*/
|
*/
|
||||||
private String deviceType;
|
private String deviceType;
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,27 @@ public class DevDetailDTO {
|
|||||||
@ApiModelProperty(value = "设备名称")
|
@ApiModelProperty(value = "设备名称")
|
||||||
private String equipmentName;
|
private String equipmentName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测点id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测点名称")
|
||||||
|
private String lineName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "设备通讯状态")
|
@ApiModelProperty(value = "设备通讯状态")
|
||||||
private Integer runStatus;
|
private Integer runStatus;
|
||||||
|
|
||||||
@ApiModelProperty(value = "设备MAC地址")
|
@ApiModelProperty(value = "设备MAC地址")
|
||||||
private String devMac;
|
private String devMac;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "nDid")
|
||||||
|
private String nDid;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测对象")
|
||||||
|
private String objType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备治理方案")
|
||||||
|
private String governType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "监测点id集合")
|
@ApiModelProperty(value = "监测点id集合")
|
||||||
private List<String> lineList;
|
private List<String> lineList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,5 +44,6 @@ public class AppLineTopologyDiagramParm extends BaseEntity {
|
|||||||
|
|
||||||
private Double lat;
|
private Double lat;
|
||||||
|
|
||||||
|
private String target;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -106,4 +106,18 @@ public class CsEquipmentDeliveryAddParm implements Serializable {
|
|||||||
@ApiModelProperty(value="所属项目")
|
@ApiModelProperty(value="所属项目")
|
||||||
private String associatedProject;
|
private String associatedProject;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="icd")
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="是否支持升级(0:否 1:是)")
|
||||||
|
private Integer upgrade;
|
||||||
|
|
||||||
|
@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="所属项目")
|
@ApiModelProperty(value="所属项目")
|
||||||
private String associatedProject;
|
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 com.njcn.web.pojo.param.BaseParam;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -40,4 +41,9 @@ public class CsEquipmentDeliveryQueryParm extends BaseParam {
|
|||||||
@ApiModelProperty("物联通讯状态 0:未连接 1:已连接")
|
@ApiModelProperty("物联通讯状态 0:未连接 1:已连接")
|
||||||
private Integer connectStatus;
|
private Integer connectStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty("ICD")
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否支持升级(0:否 1:是)")
|
||||||
|
private Integer upgrade;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.njcn.csdevice.pojo.param;
|
||||||
|
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-07
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class DevVersionParam extends BaseParam {
|
||||||
|
private String keyword;
|
||||||
|
}
|
||||||
@@ -45,5 +45,7 @@ public class AppLineTopologyDiagramPO extends BaseEntity {
|
|||||||
@TableField(value = "lat")
|
@TableField(value = "lat")
|
||||||
private Double lat;
|
private Double lat;
|
||||||
|
|
||||||
|
@TableField(value = "target")
|
||||||
|
private String target;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.csdevice.pojo.po;
|
package com.njcn.csdevice.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.njcn.db.bo.BaseEntity;
|
import com.njcn.db.bo.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -43,6 +44,12 @@ public class CsDataArray extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String anotherName;
|
private String anotherName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* influxdb 存储的名称
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String influxDbName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典序号
|
* 字典序号
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ import com.njcn.db.bo.BaseEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
* Date: 2023/4/7 11:29【需求编号】
|
* Date: 2023/4/7 11:29【需求编号】
|
||||||
@@ -62,7 +61,7 @@ public class CsEdDataPO extends BaseEntity {
|
|||||||
* 版本日期
|
* 版本日期
|
||||||
*/
|
*/
|
||||||
@TableField(value = "version_date")
|
@TableField(value = "version_date")
|
||||||
private Date versionDate;
|
private LocalDateTime versionDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述
|
* 描述
|
||||||
@@ -95,5 +94,4 @@ public class CsEdDataPO extends BaseEntity {
|
|||||||
private String crc;
|
private String crc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -148,4 +148,32 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
|||||||
@TableField(value = "associated_project")
|
@TableField(value = "associated_project")
|
||||||
private String associatedProject;
|
private String associatedProject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* icd模型
|
||||||
|
*/
|
||||||
|
@TableField(value = "icd")
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否支持升级(0:否 1:是)
|
||||||
|
*/
|
||||||
|
private Integer upgrade;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 治理方法
|
||||||
|
*/
|
||||||
|
@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")
|
@TableField(value = "monitor_obj")
|
||||||
private String monitorObj;
|
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;
|
package com.njcn.csdevice.pojo.vo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.njcn.db.bo.BaseEntity;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,5 +41,6 @@ public class AppLineTopologyDiagramVO {
|
|||||||
|
|
||||||
private String linePostion;
|
private String linePostion;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="绑定的指标")
|
||||||
|
private String target;
|
||||||
}
|
}
|
||||||
@@ -70,12 +70,11 @@ public class CsEdDataVO extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "版本类型")
|
@ApiModelProperty(value = "版本类型")
|
||||||
private String versionType;
|
private String versionType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "crc信息")
|
|
||||||
private String crcInfo;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = ".bin文件")
|
@ApiModelProperty(value = ".bin文件")
|
||||||
private String filePath;
|
private String filePath;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "CRC校验")
|
||||||
|
private String crc;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -106,4 +106,13 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
|||||||
@ApiModelProperty(value="所属项目名称")
|
@ApiModelProperty(value="所属项目名称")
|
||||||
private String associatedProjectName;
|
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 lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,6 +30,9 @@ public class DataGroupEventVO {
|
|||||||
@ApiModelProperty("装置ID")
|
@ApiModelProperty("装置ID")
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备网络码")
|
||||||
|
private String nDid;
|
||||||
|
|
||||||
@ApiModelProperty("装置名称")
|
@ApiModelProperty("装置名称")
|
||||||
private String devName;
|
private String devName;
|
||||||
|
|
||||||
@@ -65,9 +67,24 @@ public class DataGroupEventVO {
|
|||||||
private Double amplitude;
|
private Double amplitude;
|
||||||
|
|
||||||
@ApiModelProperty("严重度")
|
@ApiModelProperty("严重度")
|
||||||
private String severity;
|
private Double severity;
|
||||||
|
|
||||||
@ApiModelProperty("波形路径")
|
@ApiModelProperty("波形路径")
|
||||||
private String wavePath;
|
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 = "反馈数")
|
@ApiModelProperty(value = "反馈数")
|
||||||
private Integer feedBackCount = 0;
|
private Integer feedBackCount = 0;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "当前工程监测点数")
|
||||||
|
private Integer lineCount = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package com.njcn.csdevice.pojo.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DevVersionVO {
|
||||||
|
/**
|
||||||
|
* 设备Id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议版本号
|
||||||
|
*/
|
||||||
|
private String protocolVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime versionDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备型号
|
||||||
|
*/
|
||||||
|
private String devModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型名称
|
||||||
|
*/
|
||||||
|
private String devModelName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* icd型号
|
||||||
|
*/
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属工程
|
||||||
|
*/
|
||||||
|
private String associatedEngineering;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属项目
|
||||||
|
*/
|
||||||
|
private String associatedProject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置启用状态(0:停用 1:启用)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人员
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人名称
|
||||||
|
*/
|
||||||
|
private String updateByName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备运行状态(0:删除 1:离线 2:在线)
|
||||||
|
*/
|
||||||
|
private Integer runStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否支持升级(0:否 1:是)
|
||||||
|
*/
|
||||||
|
private Integer upgrade;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备与MQTT服务器连接状态 (0:未连接 1:已连接)
|
||||||
|
*/
|
||||||
|
private Integer connectStatus;
|
||||||
|
}
|
||||||
@@ -62,5 +62,8 @@ public class DeviceManagerVO {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "数据类型 rt:实时数据 history:历史数据")
|
@ApiModelProperty(value = "数据类型 rt:实时数据 history:历史数据")
|
||||||
private String type;
|
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
|
@Data
|
||||||
public class PqSensitiveUserLineVO {
|
public class PqSensitiveUserLineVO {
|
||||||
|
@ApiModelProperty("工程名称")
|
||||||
|
private String engineeringName;
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
@ApiModelProperty("设备id")
|
||||||
|
private String devId;
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String devName;
|
||||||
@ApiModelProperty("治理对象")
|
@ApiModelProperty("治理对象")
|
||||||
private String sensitiveUser;
|
private String sensitiveUser;
|
||||||
@ApiModelProperty("监测点ID")
|
@ApiModelProperty("监测点ID")
|
||||||
private String lineId;
|
private String lineId;
|
||||||
@ApiModelProperty("测点名称")
|
@ApiModelProperty("测点名称")
|
||||||
private String lineName;
|
private String lineName;
|
||||||
@ApiModelProperty("是否治理")
|
@ApiModelProperty("治理方案")
|
||||||
private String govern;
|
private String govern;
|
||||||
@ApiModelProperty("电压等级")
|
@ApiModelProperty("电压等级")
|
||||||
private double volGrade;
|
private double volGrade;
|
||||||
@ApiModelProperty("监测类型")
|
@ApiModelProperty("监测位置")
|
||||||
private String position;
|
private String position;
|
||||||
@ApiModelProperty("运行状态")
|
@ApiModelProperty("运行状态")
|
||||||
private String runStatus;
|
private String runStatus;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.pojo.vo;
|
|||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,6 +21,9 @@ public class RecordAllDevTreeVo {
|
|||||||
@ApiModelProperty("设备名称")
|
@ApiModelProperty("设备名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备状态")
|
||||||
|
private Integer runStatus;
|
||||||
|
|
||||||
@ApiModelProperty("线路")
|
@ApiModelProperty("线路")
|
||||||
private List<RecordAllLineTreeVo> children;
|
private List<RecordAllLineTreeVo> children;
|
||||||
|
|
||||||
|
|||||||
@@ -167,6 +167,11 @@
|
|||||||
<artifactId>message-api</artifactId>
|
<artifactId>message-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>event-common</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -101,7 +100,6 @@ public class CsDataArrayController extends BaseController {
|
|||||||
@PostMapping("/findListByParam")
|
@PostMapping("/findListByParam")
|
||||||
@ApiOperation("根据条件查询详细数据")
|
@ApiOperation("根据条件查询详细数据")
|
||||||
@ApiImplicitParam(name = "param", value = "参数集合", required = true)
|
@ApiImplicitParam(name = "param", value = "参数集合", required = true)
|
||||||
@ApiIgnore
|
|
||||||
public HttpResult<List<CsDataArray>> findListByParam(@RequestBody DataArrayParam param){
|
public HttpResult<List<CsDataArray>> findListByParam(@RequestBody DataArrayParam param){
|
||||||
String methodDescribe = getMethodDescribe("findListByParam");
|
String methodDescribe = getMethodDescribe("findListByParam");
|
||||||
List<CsDataArray> list = csDataArrayService.findListByParam(param);
|
List<CsDataArray> list = csDataArrayService.findListByParam(param);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.njcn.csdevice.controller.equipment;
|
package com.njcn.csdevice.controller.equipment;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
@@ -10,7 +9,6 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
|
||||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||||
import com.njcn.csdevice.service.ICsEventSendMsgService;
|
import com.njcn.csdevice.service.ICsEventSendMsgService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
|
|||||||
@@ -66,7 +66,5 @@ public class CsSoftInfoController extends BaseController {
|
|||||||
csSoftInfoService.removeById(id);
|
csSoftInfoService.removeById(id);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,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.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
@@ -64,7 +66,6 @@ public class DevModelController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryDevModelPage")
|
@PostMapping("/queryDevModelPage")
|
||||||
@ApiOperation("设备模板分页查询")
|
@ApiOperation("设备模板分页查询")
|
||||||
@@ -110,5 +111,4 @@ public class DevModelController extends BaseController {
|
|||||||
CsDevModelPO po = csDevModelService.getModelById(id);
|
CsDevModelPO po = csDevModelService.getModelById(id);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
|||||||
import com.njcn.csdevice.pojo.param.*;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DevVersionVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||||
import com.njcn.csdevice.service.CsDevModelRelationService;
|
import com.njcn.csdevice.service.CsDevModelRelationService;
|
||||||
@@ -46,6 +47,7 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
@@ -416,4 +418,16 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/version/page")
|
||||||
|
@ApiOperation("查询设备版本信息")
|
||||||
|
@ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true)
|
||||||
|
public HttpResult<IPage<DevVersionVO>> versionPage(@RequestBody CsEquipmentDeliveryQueryParm baseParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("versionPage");
|
||||||
|
|
||||||
|
IPage<DevVersionVO> list = csEquipmentDeliveryService.versionPage(baseParam);
|
||||||
|
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,39 +1,23 @@
|
|||||||
package com.njcn.csdevice.controller.ledger;
|
package com.njcn.csdevice.controller.ledger;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
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.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.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.CsLinePO;
|
|
||||||
import com.njcn.csdevice.service.CsCommTerminalService;
|
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.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 com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
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);
|
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")
|
@PostMapping("/AppLineTree")
|
||||||
@ApiOperation("app端监测点树")
|
@ApiOperation("app端监测点树")
|
||||||
public HttpResult<List<CsLedgerVO>> appLineTree(){
|
public HttpResult<List<CsLedgerVO>> appLineTree(){
|
||||||
String methodDescribe = getMethodDescribe("AppLineTree");
|
String methodDescribe = getMethodDescribe("appLineTree");
|
||||||
List<CsLedgerVO> list = csLedgerService.appLineTree();
|
List<CsLedgerVO> list = csLedgerService.appLineTree();
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
@@ -90,14 +90,14 @@ public class CsLedgerController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/objTree")
|
// @PostMapping("/objTree")
|
||||||
@ApiOperation("三层对象用户树")
|
// @ApiOperation("三层对象用户树")
|
||||||
public HttpResult<List<CsLedgerVO>> objTree(){
|
// public HttpResult<List<CsLedgerVO>> objTree(){
|
||||||
String methodDescribe = getMethodDescribe("getProjectTree");
|
// String methodDescribe = getMethodDescribe("getProjectTree");
|
||||||
List<CsLedgerVO> list = csLedgerService.objTree();
|
// List<CsLedgerVO> list = csLedgerService.objTree();
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||||
@@ -295,11 +296,11 @@ public class CslineController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getLineBySensitiveUser")
|
@PostMapping("/getDevBySensitiveUser")
|
||||||
@ApiOperation("根据敏感用户查询监测点")
|
@ApiOperation("根据敏感用户查询装置")
|
||||||
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list) {
|
public HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(@RequestBody List<String> list) {
|
||||||
String methodDescribe = getMethodDescribe("getLineBySensitiveUser");
|
String methodDescribe = getMethodDescribe("getDevBySensitiveUser");
|
||||||
List<CsLinePO> result = csLinePOService.getLineBySensitiveUser(list);
|
List<CsEquipmentDeliveryPO> result = csLinePOService.getDevBySensitiveUser(list);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
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.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||||
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
import com.njcn.csdevice.param.LineInfoParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
|
||||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceManagerDetailVO;
|
|
||||||
import com.njcn.csdevice.service.DeviceMessageService;
|
import com.njcn.csdevice.service.DeviceMessageService;
|
||||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
|
||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -22,7 +18,6 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -48,7 +43,7 @@ public class DeviceMessageController extends BaseController {
|
|||||||
@ApiOperation("根据设备获取需要推送的用户id")
|
@ApiOperation("根据设备获取需要推送的用户id")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "devId", value = "设备id", required = true, paramType = "query"),
|
@ApiImplicitParam(name = "devId", value = "设备id", required = true, paramType = "query"),
|
||||||
@ApiImplicitParam(name = "isAdmin", value = "是否需要推送给管理员", required = true, paramType = "query")
|
@ApiImplicitParam(name = "isAdmin", value = "是否需要推送给普通用户", required = true, paramType = "query")
|
||||||
})
|
})
|
||||||
public HttpResult<List<String>> getEventUserByDeviceId(@RequestParam("devId") String devId, @RequestParam("isAdmin") Boolean isAdmin){
|
public HttpResult<List<String>> getEventUserByDeviceId(@RequestParam("devId") String devId, @RequestParam("isAdmin") Boolean isAdmin){
|
||||||
String methodDescribe = getMethodDescribe("getEventUserByDeviceId");
|
String methodDescribe = getMethodDescribe("getEventUserByDeviceId");
|
||||||
@@ -69,10 +64,10 @@ public class DeviceMessageController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getLineInfo")
|
@PostMapping("/getLineInfo")
|
||||||
@ApiOperation("获取监测点信息")
|
@ApiOperation("获取监测点信息")
|
||||||
@ApiImplicitParam(name = "id", value = "参数", required = true, paramType = "query")
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
public HttpResult<String> getLineInfo(@RequestParam("id") String id){
|
public HttpResult<String> getLineInfo(@RequestBody LineInfoParam param){
|
||||||
String methodDescribe = getMethodDescribe("getLineInfo");
|
String methodDescribe = getMethodDescribe("getLineInfo");
|
||||||
deviceMessageService.getLineInfo(id);
|
deviceMessageService.getLineInfo(param.getNDid(),param.getList());
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "success", methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "success", methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
package com.njcn.csdevice.controller.message;
|
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
|
||||||
import com.njcn.csdevice.pojo.vo.MessageRecordReqVO;
|
|
||||||
import com.njcn.csdevice.service.ISmsSendService;
|
|
||||||
import com.njcn.web.controller.BaseController;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xy
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/sms")
|
|
||||||
@Api(tags = "短信发送管理")
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class SmsSendController extends BaseController {
|
|
||||||
|
|
||||||
private final ISmsSendService smsSendService;
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
@PostMapping("/send")
|
|
||||||
@ApiOperation("发送短信(同步,包含重试)")
|
|
||||||
public HttpResult<String> sendSms(@RequestBody MessageRecordReqVO vo) {
|
|
||||||
String methodDescribe = getMethodDescribe("sendSms");
|
|
||||||
|
|
||||||
try {
|
|
||||||
smsSendService.sendSmsWithRetry(vo);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(
|
|
||||||
CommonResponseEnum.SUCCESS,
|
|
||||||
"短信发送成功",
|
|
||||||
methodDescribe
|
|
||||||
);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("短信发送失败", e);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(
|
|
||||||
CommonResponseEnum.FAIL,
|
|
||||||
e.getMessage(),
|
|
||||||
methodDescribe
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
@PostMapping("/send/simple")
|
|
||||||
@ApiOperation("发送短信(简化参数)")
|
|
||||||
public HttpResult<String> sendSmsSimple(
|
|
||||||
@RequestParam String receiver,
|
|
||||||
@RequestParam String content,
|
|
||||||
@RequestParam(defaultValue = "verify_code") String messageType) {
|
|
||||||
String methodDescribe = getMethodDescribe("sendSmsSimple");
|
|
||||||
|
|
||||||
try {
|
|
||||||
smsSendService.sendSmsWithRetry(receiver, content, messageType);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(
|
|
||||||
CommonResponseEnum.SUCCESS,
|
|
||||||
"短信发送成功",
|
|
||||||
methodDescribe
|
|
||||||
);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("短信发送失败", e);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(
|
|
||||||
CommonResponseEnum.FAIL,
|
|
||||||
e.getMessage(),
|
|
||||||
methodDescribe
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,6 +9,7 @@ import com.njcn.common.utils.HttpResultUtil;
|
|||||||
import com.njcn.csdevice.pojo.param.CsEdDataAddParm;
|
import com.njcn.csdevice.pojo.param.CsEdDataAddParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsEdDataAuditParm;
|
import com.njcn.csdevice.pojo.param.CsEdDataAuditParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsEdDataQueryParm;
|
import com.njcn.csdevice.pojo.param.CsEdDataQueryParm;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEdDataPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
||||||
import com.njcn.csdevice.service.CsEdDataService;
|
import com.njcn.csdevice.service.CsEdDataService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -79,4 +80,14 @@ public class CsEdDataController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/getById")
|
||||||
|
@ApiOperation("根据id查询")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||||
|
public HttpResult<CsEdDataPO> getById(@Validated @RequestParam("id") String id){
|
||||||
|
String methodDescribe = getMethodDescribe("getById");
|
||||||
|
CsEdDataPO dataPO = csEdDataService.getById(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dataPO, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,10 @@ package com.njcn.csdevice.handler;
|
|||||||
|
|
||||||
|
|
||||||
import com.github.tocrhz.mqtt.annotation.MqttSubscribe;
|
import com.github.tocrhz.mqtt.annotation.MqttSubscribe;
|
||||||
|
|
||||||
import com.github.tocrhz.mqtt.annotation.Payload;
|
import com.github.tocrhz.mqtt.annotation.Payload;
|
||||||
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.csdevice.service.CsLogsPOService;
|
import com.njcn.cssystem.api.CsLogsFeignClient;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
@@ -25,8 +23,7 @@ import java.nio.charset.StandardCharsets;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class MqttMessageHandler {
|
public class MqttMessageHandler {
|
||||||
|
|
||||||
|
private final CsLogsFeignClient csLogsFeignClient;
|
||||||
private final CsLogsPOService csLogsPOService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入devicelog
|
* 插入devicelog
|
||||||
@@ -34,7 +31,7 @@ public class MqttMessageHandler {
|
|||||||
@MqttSubscribe(value = "/deviceLog")
|
@MqttSubscribe(value = "/deviceLog")
|
||||||
public void responseRtData(String topic, MqttMessage message, @Payload String payload) {
|
public void responseRtData(String topic, MqttMessage message, @Payload String payload) {
|
||||||
DeviceLogDTO deviceLogDTO = PubUtils.json2obj(new String(message.getPayload(), StandardCharsets.UTF_8),DeviceLogDTO.class);
|
DeviceLogDTO deviceLogDTO = PubUtils.json2obj(new String(message.getPayload(), StandardCharsets.UTF_8),DeviceLogDTO.class);
|
||||||
csLogsPOService.addLog(deviceLogDTO);
|
csLogsFeignClient.addUserLog(deviceLogDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package com.njcn.csdevice.mapper;
|
package com.njcn.csdevice.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
|
||||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
package com.njcn.csdevice.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsSmsSendRecord;
|
|
||||||
|
|
||||||
public interface CsSmsSendRecordMapper extends BaseMapper<CsSmsSendRecord> {
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.njcn.csdevice.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-23
|
||||||
|
*/
|
||||||
|
public interface CsUpgradeLogsMapper extends BaseMapper<CsUpgradeLogs> {
|
||||||
|
}
|
||||||
@@ -105,7 +105,6 @@
|
|||||||
t0.ndid = #{param.id}
|
t0.ndid = #{param.id}
|
||||||
and t1.did = #{param.did}
|
and t1.did = #{param.did}
|
||||||
and t3.cl_dev = #{param.cldId}
|
and t3.cl_dev = #{param.cldId}
|
||||||
and (t3.data_type = 'Stat' or t3.data_type is NULL)
|
|
||||||
and t3.idx = #{param.idx}
|
and t3.idx = #{param.idx}
|
||||||
and t4.stat_method = #{param.statMethod}
|
and t4.stat_method = #{param.statMethod}
|
||||||
order by t4.sort
|
order by t4.sort
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
where
|
where
|
||||||
pid = #{modelId}
|
pid = #{modelId}
|
||||||
and cl_dev = #{clDev}
|
and cl_dev = #{clDev}
|
||||||
and (data_type = 'Stat' or data_type IS NULL)
|
-- and (data_type = 'Stat' or data_type IS NULL)
|
||||||
|
and store_flag = 1
|
||||||
order by type,cl_dev
|
order by type,cl_dev
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
t1.*
|
t1.*
|
||||||
from
|
from
|
||||||
cs_equipment_delivery t0
|
cs_equipment_delivery t0
|
||||||
left join cs_line t1 on
|
right join cs_line t1 on
|
||||||
t0.id = t1.device_id
|
t0.id = t1.device_id
|
||||||
where
|
where
|
||||||
t0.ndid = #{id}
|
t0.ndid = #{id}
|
||||||
@@ -57,7 +57,8 @@
|
|||||||
<select id="findLineList" resultType="com.njcn.csdevice.pojo.dto.CsLineDTO">
|
<select id="findLineList" resultType="com.njcn.csdevice.pojo.dto.CsLineDTO">
|
||||||
SELECT
|
SELECT
|
||||||
t1.*,
|
t1.*,
|
||||||
t2.dev_type deviceType
|
t2.dev_type deviceType,
|
||||||
|
t2.name deviceName
|
||||||
FROM
|
FROM
|
||||||
cs_line t1
|
cs_line t1
|
||||||
LEFT JOIN cs_equipment_delivery t2 ON t1.device_id = t2.id
|
LEFT JOIN cs_equipment_delivery t2 ON t1.device_id = t2.id
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
<select id="getRecordAll" resultType="com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo">
|
<select id="getRecordAll" resultType="com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo">
|
||||||
<if test="wlRecordPageParam.isTrueFlag == 0">
|
<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
|
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
|
where a.type=1 and a.state =1 and a.end_time is not null
|
||||||
and
|
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
|
group by a.dev_id,b.name having a.dev_id is not null and b.name is not null
|
||||||
</if>
|
</if>
|
||||||
<if test="wlRecordPageParam.isTrueFlag == 1">
|
<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
|
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
|
where a.type=1 and a.state =1 and a.end_time is not null
|
||||||
and exists
|
and exists
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csdevice.service;
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -14,4 +15,6 @@ public interface CsCommTerminalService {
|
|||||||
PqsDeviceUnit lineUnitDetail(String lineId);
|
PqsDeviceUnit lineUnitDetail(String lineId);
|
||||||
|
|
||||||
List<String> commGetDevIds(String userId);
|
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);
|
void channelDevByUserId(UserDevParam param);
|
||||||
|
|
||||||
List<CsDeviceUserPO> getList(UserDevParam param);
|
List<CsDeviceUserPO> getList(UserDevParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户设备关系表数据 新增主用户信息 && 新增已关联工程的用户的设备关系
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean addRelation(UserDevParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,5 +48,13 @@ public interface CsEdDataService extends IService<CsEdDataPO> {
|
|||||||
* @author: xuyang
|
* @author: xuyang
|
||||||
*/
|
*/
|
||||||
CsEdDataVO findByDevTypeId(String devType);
|
CsEdDataVO findByDevTypeId(String devType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 根据装置型号和版本号获取装置类型
|
||||||
|
* @param devTypeId 装置型号
|
||||||
|
* @param versionNo 版本号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CsEdDataPO findByDevTypeIdAndVersionNo(String devTypeId, String versionNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,10 @@ package com.njcn.csdevice.service;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAuditParm;
|
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
|
||||||
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DevVersionVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -195,4 +193,5 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
|
|
||||||
List<CsEquipmentDeliveryPO> getRunPortableDev(String userId);
|
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.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||||
@@ -86,7 +87,7 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
|||||||
|
|
||||||
List<CsLinePO> getSimpleLine();
|
List<CsLinePO> getSimpleLine();
|
||||||
|
|
||||||
List<CsLinePO> getLineBySensitiveUser(List<String> list);
|
List<CsEquipmentDeliveryPO> getDevBySensitiveUser(List<String> list);
|
||||||
|
|
||||||
Page<PqSensitiveUserLineVO> getSensitiveUserLineList(BaseParam param);
|
Page<PqSensitiveUserLineVO> getSensitiveUserLineList(BaseParam param);
|
||||||
boolean uploadReport(MultipartFile file, String lineId);
|
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;
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -14,6 +15,6 @@ public interface DeviceMessageService {
|
|||||||
|
|
||||||
List<User> getSendUserByType(DeviceMessageParam param);
|
List<User> getSendUserByType(DeviceMessageParam param);
|
||||||
|
|
||||||
void getLineInfo(String id);
|
void getLineInfo(String id,List<CsLinePO> list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.csdevice.service;
|
|||||||
|
|
||||||
import com.njcn.csdevice.param.LineCountEvaluateParam;
|
import com.njcn.csdevice.param.LineCountEvaluateParam;
|
||||||
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
|
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -20,6 +21,13 @@ public interface ICsCommunicateService {
|
|||||||
*/
|
*/
|
||||||
List<PqsCommunicateDto> getRawDataLatest(LineCountEvaluateParam lineParam);
|
List<PqsCommunicateDto> getRawDataLatest(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取出第一条装置数据
|
||||||
|
* @param lineParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PqsCommunicateDto> getRawDataOne(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取时间范围数据
|
* 获取时间范围数据
|
||||||
* @param lineParam
|
* @param lineParam
|
||||||
@@ -27,6 +35,8 @@ public interface ICsCommunicateService {
|
|||||||
*/
|
*/
|
||||||
List<PqsCommunicateDto> getRawData(LineCountEvaluateParam lineParam);
|
List<PqsCommunicateDto> getRawData(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
|
List<PqsCommunicateDto> getRawData2(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*是否有当天最后一条数据
|
*是否有当天最后一条数据
|
||||||
* @param lineParam
|
* @param lineParam
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
|||||||
List<CsLedgerVO> getztProjectTree();
|
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> {
|
public interface IRStatOnlineRateDService extends IService<RStatOnlineRateD> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.查询该设备当前计算周期是否存在上下线记录
|
||||||
|
* 2.
|
||||||
|
* a.存在记录,如果只有1条数据,则根据这一条记录的状态计算在线时长;如果是多条数据,则根据上下线时间计算在线时长;
|
||||||
|
* b.不存在记录,则需要借助历史记录判断:
|
||||||
|
* 1) 先查询设备第一条记录时间
|
||||||
|
* - 如果统计日期 < 第一条记录时间 → 设备未上线 → 离线
|
||||||
|
* 2) 再查询最新记录时间和状态
|
||||||
|
* - 如果统计日期 > 最新记录时间 → 延续最新状态
|
||||||
|
* * 最新是在线 → 全天在线
|
||||||
|
* * 最新是离线 → 全天离线
|
||||||
|
* @param param
|
||||||
|
*/
|
||||||
void addData(StatisticsDataParam param);
|
void addData(StatisticsDataParam param);
|
||||||
|
|
||||||
List<RStatOnlineRateD> getData(List<String> list, String startTime, String endTime);
|
List<RStatOnlineRateD> getData(List<String> list, String startTime, String endTime);
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.njcn.csdevice.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsSmsSendRecord;
|
|
||||||
import com.njcn.csdevice.pojo.vo.MessageRecordReqVO;
|
|
||||||
|
|
||||||
public interface ISmsSendService extends IService<CsSmsSendRecord> {
|
|
||||||
|
|
||||||
void sendSmsWithRetry(String receiver, String content, String messageType);
|
|
||||||
|
|
||||||
void sendSmsWithRetry(MessageRecordReqVO messageRecordReqVO);
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.mapper.AppLineTopologyDiagramMapper;
|
import com.njcn.csdevice.mapper.AppLineTopologyDiagramMapper;
|
||||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
|
||||||
import com.njcn.csdevice.pojo.param.AppTopologyDiagramQueryParm;
|
import com.njcn.csdevice.pojo.param.AppTopologyDiagramQueryParm;
|
||||||
import com.njcn.csdevice.pojo.param.LinePostionParam;
|
import com.njcn.csdevice.pojo.param.LinePostionParam;
|
||||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||||
@@ -13,11 +12,14 @@ import com.njcn.csdevice.pojo.po.CsLedger;
|
|||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.AppLineTopologyDiagramVO;
|
import com.njcn.csdevice.pojo.vo.AppLineTopologyDiagramVO;
|
||||||
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLineTopologyTemplateVO;
|
|
||||||
import com.njcn.csdevice.service.AppLineTopologyDiagramService;
|
import com.njcn.csdevice.service.AppLineTopologyDiagramService;
|
||||||
import com.njcn.csdevice.service.AppTopologyDiagramService;
|
import com.njcn.csdevice.service.AppTopologyDiagramService;
|
||||||
import com.njcn.csdevice.service.CsLinePOService;
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
import com.njcn.csdevice.service.ICsLedgerService;
|
import com.njcn.csdevice.service.ICsLedgerService;
|
||||||
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
|
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -41,6 +43,9 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopolo
|
|||||||
private final CsLinePOService csLinePOService;
|
private final CsLinePOService csLinePOService;
|
||||||
private final AppTopologyDiagramService appTopologyDiagramService;
|
private final AppTopologyDiagramService appTopologyDiagramService;
|
||||||
private final ICsLedgerService iCsLedgerService;
|
private final ICsLedgerService iCsLedgerService;
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AppTopologyDiagramVO query(String devId) {
|
public AppTopologyDiagramVO query(String devId) {
|
||||||
CsLedger one = iCsLedgerService.lambdaQuery().eq(CsLedger::getId, devId).eq(CsLedger::getState,1).one();
|
CsLedger one = iCsLedgerService.lambdaQuery().eq(CsLedger::getId, devId).eq(CsLedger::getState,1).one();
|
||||||
@@ -73,7 +78,7 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopolo
|
|||||||
}
|
}
|
||||||
public List<AppLineTopologyDiagramVO> queryByLineIds(List<String> lineIds) {
|
public List<AppLineTopologyDiagramVO> queryByLineIds(List<String> lineIds) {
|
||||||
List<AppLineTopologyDiagramVO> result = new ArrayList<>();
|
List<AppLineTopologyDiagramVO> result = new ArrayList<>();
|
||||||
if (lineIds != null && lineIds.size() > 0) {
|
if (lineIds != null && !lineIds.isEmpty()) {
|
||||||
result = this.getBaseMapper().queryByLineIds( lineIds);
|
result = this.getBaseMapper().queryByLineIds( lineIds);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -83,15 +88,22 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopolo
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void auditList(LinePostionParam linePostionParam) {
|
public void auditList(LinePostionParam linePostionParam) {
|
||||||
|
|
||||||
|
|
||||||
linePostionParam.getPointList().forEach(temp->{
|
linePostionParam.getPointList().forEach(temp->{
|
||||||
csLinePOService.lambdaUpdate().eq(CsLinePO::getLineId,temp.getLineId()).set(CsLinePO::getName,temp.getName()).set(CsLinePO::getPosition,temp.getLinePostion()).update();
|
csLinePOService.lambdaUpdate().eq(CsLinePO::getLineId,temp.getLineId()).set(CsLinePO::getName,temp.getName()).set(CsLinePO::getPosition,temp.getLinePostion()).update();
|
||||||
this.lambdaUpdate().eq(AppLineTopologyDiagramPO::getId,temp.getId()).
|
this.lambdaUpdate().eq(AppLineTopologyDiagramPO::getId,temp.getId()).
|
||||||
eq(AppLineTopologyDiagramPO::getLineId,temp.getLineId()).set(AppLineTopologyDiagramPO::getLat,temp.getLat()).
|
eq(AppLineTopologyDiagramPO::getLineId,temp.getLineId()).set(AppLineTopologyDiagramPO::getLat,temp.getLat()).
|
||||||
set(AppLineTopologyDiagramPO::getLng,temp.getLng()).set(AppLineTopologyDiagramPO::getId,linePostionParam.getId()).update();
|
set(AppLineTopologyDiagramPO::getLng,temp.getLng()).set(AppLineTopologyDiagramPO::getId,linePostionParam.getId())
|
||||||
|
.set(AppLineTopologyDiagramPO::getTarget,temp.getTarget())
|
||||||
|
.update();
|
||||||
iCsLedgerService.lambdaUpdate().eq(CsLedger::getId,temp.getLineId()).set(CsLedger::getName,temp.getName()).update();
|
iCsLedgerService.lambdaUpdate().eq(CsLedger::getId,temp.getLineId()).set(CsLedger::getName,temp.getName()).update();
|
||||||
});
|
});
|
||||||
|
//修改指标后,删除缓存数据
|
||||||
|
String deviceId = csLinePOService.getById(linePostionParam.getPointList().get(0).getLineId()).getDeviceId();
|
||||||
|
DictTreeVO dictTreeVO = dictTreeFeignClient.queryByCode("baseData").getData();
|
||||||
|
String key = deviceId + "#";
|
||||||
|
if (dictTreeVO != null) {
|
||||||
|
key = deviceId + "#" + dictTreeVO.getId();
|
||||||
|
}
|
||||||
|
redisUtil.delete(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
|||||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
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.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsTouristDataParmVO;
|
import com.njcn.csdevice.pojo.vo.CsTouristDataParmVO;
|
||||||
@@ -21,9 +22,7 @@ import com.njcn.web.utils.RequestUtil;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,12 +69,9 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
|||||||
if (CollUtil.isEmpty(devIds)) {
|
if (CollUtil.isEmpty(devIds)) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
List<CsEquipmentDeliveryPO> po = csEquipmentDeliveryService.listByIds(devIds);
|
||||||
lambdaQueryWrapper.select(CsLinePO::getLineId, CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId, devIds)
|
if (CollUtil.isEmpty(po)) {
|
||||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode());
|
result = po.stream().map(CsEquipmentDeliveryPO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||||
List<CsLinePO> poList =csLinePOMapper.selectList(lambdaQueryWrapper);
|
|
||||||
if (CollUtil.isNotEmpty(poList)) {
|
|
||||||
result = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -126,4 +122,91 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
|||||||
}
|
}
|
||||||
return devIds;
|
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;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
||||||
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
||||||
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
|
||||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceManagerDetailVO;
|
import com.njcn.csdevice.pojo.vo.DeviceManagerDetailVO;
|
||||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -33,6 +37,7 @@ import java.util.stream.Collectors;
|
|||||||
public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDataArray> implements ICsDataArrayService {
|
public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDataArray> implements ICsDataArrayService {
|
||||||
|
|
||||||
private final EpdFeignClient epdFeignClient;
|
private final EpdFeignClient epdFeignClient;
|
||||||
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsDataArray> getArrayBySet(String dataSet) {
|
public List<CsDataArray> getArrayBySet(String dataSet) {
|
||||||
@@ -52,7 +57,7 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
|||||||
for (Map.Entry<String, List<EleEpdPqd>> entry : map.entrySet()) {
|
for (Map.Entry<String, List<EleEpdPqd>> entry : map.entrySet()) {
|
||||||
DeviceManagerDetailVO vo = new DeviceManagerDetailVO();
|
DeviceManagerDetailVO vo = new DeviceManagerDetailVO();
|
||||||
EleEpdPqd eleEpdPqd = entry.getValue().get(0);
|
EleEpdPqd eleEpdPqd = entry.getValue().get(0);
|
||||||
if (Objects.equals(eleEpdPqd.getPhase(),"M")){
|
if (Objects.equals(eleEpdPqd.getPhase(),"T")){
|
||||||
vo.setPhasic("/");
|
vo.setPhasic("/");
|
||||||
} else {
|
} else {
|
||||||
vo.setPhasic(entry.getValue().stream().map(EleEpdPqd::getPhase).collect(Collectors.joining(",")));
|
vo.setPhasic(entry.getValue().stream().map(EleEpdPqd::getPhase).collect(Collectors.joining(",")));
|
||||||
@@ -104,7 +109,7 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
|||||||
DataArrayTreeVO vo3 = new DataArrayTreeVO();
|
DataArrayTreeVO vo3 = new DataArrayTreeVO();
|
||||||
vo3.setId(item.getDataSetId() + item.getDataArrayName()+item2);
|
vo3.setId(item.getDataSetId() + item.getDataArrayName()+item2);
|
||||||
vo3.setName(item2);
|
vo3.setName(item2);
|
||||||
if (Objects.equals(item2,"M")){
|
if (Objects.equals(item2,"T")){
|
||||||
vo3.setShowName("无相别");
|
vo3.setShowName("无相别");
|
||||||
} else {
|
} else {
|
||||||
vo3.setShowName(item2);
|
vo3.setShowName(item2);
|
||||||
@@ -173,7 +178,34 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsDataArray> findListByParam(DataArrayParam param) {
|
public List<CsDataArray> findListByParam(DataArrayParam param) {
|
||||||
return this.baseMapper.findListByParam(param);
|
List<CsDataArray> list = this.baseMapper.findListByParam(param);
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
DictData pqd = dicDataFeignClient.getDicDataByCode(DicDataEnum.PQD.getCode()).getData();
|
||||||
|
if (ObjectUtil.isNotNull(pqd) && ObjectUtil.isNotNull(pqd.getId())) {
|
||||||
|
List<EleEpdPqd> epdList = epdFeignClient.dictMarkByDataType(pqd.getId()).getData();
|
||||||
|
if (!CollectionUtils.isEmpty(epdList)) {
|
||||||
|
Map<String, EleEpdPqd> epdPqdMap = epdList.stream().collect(Collectors.toMap(EleEpdPqd::getId, Function.identity()));
|
||||||
|
list.forEach(item->{
|
||||||
|
EleEpdPqd epdPqd = epdPqdMap.get(item.getDataId());
|
||||||
|
if (!Objects.isNull(epdPqd)) {
|
||||||
|
if (epdPqd.getOtherName() == null || epdPqd.getOtherName().isEmpty()) {
|
||||||
|
item.setInfluxDbName(epdPqd.getName());
|
||||||
|
} else {
|
||||||
|
String[] parts = item.getName().split("_");
|
||||||
|
String lastPart = parts[parts.length - 1];
|
||||||
|
boolean isLastNumeric = lastPart.matches("\\d+");
|
||||||
|
if (isLastNumeric) {
|
||||||
|
item.setInfluxDbName(epdPqd.getOtherName() + "_" + lastPart);
|
||||||
|
} else {
|
||||||
|
item.setInfluxDbName(epdPqd.getOtherName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
|||||||
.eq(CsDataSet::getPid,modelId)
|
.eq(CsDataSet::getPid,modelId)
|
||||||
.in(CsDataSet::getType, Arrays.asList(0,2))
|
.in(CsDataSet::getType, Arrays.asList(0,2))
|
||||||
.eq(CsDataSet::getStoreFlag,1)
|
.eq(CsDataSet::getStoreFlag,1)
|
||||||
.and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
|
// .and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
|
||||||
.orderByAsc(CsDataSet::getIdx)
|
.orderByAsc(CsDataSet::getIdx)
|
||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,6 +234,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//note 当前工程数据
|
//note 当前工程数据
|
||||||
|
vo.setLineCount(0);
|
||||||
//当前工程id
|
//当前工程id
|
||||||
vo.setCurrentId(id);
|
vo.setCurrentId(id);
|
||||||
//设备集合
|
//设备集合
|
||||||
@@ -286,6 +287,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
}
|
}
|
||||||
//获取未读事件数量
|
//获取未读事件数量
|
||||||
if (CollectionUtil.isNotEmpty(currentLineIds)) {
|
if (CollectionUtil.isNotEmpty(currentLineIds)) {
|
||||||
|
vo.setLineCount(currentLineIds.size());
|
||||||
CsEventUserQueryParam param1 = new CsEventUserQueryParam();
|
CsEventUserQueryParam param1 = new CsEventUserQueryParam();
|
||||||
param1.setUserId(RequestUtil.getUserIndex());
|
param1.setUserId(RequestUtil.getUserIndex());
|
||||||
param1.setStartTime(PublicDataUtils.calculateMonthStart(time));
|
param1.setStartTime(PublicDataUtils.calculateMonthStart(time));
|
||||||
@@ -545,4 +547,59 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
queryWrapper.eq(CsDeviceUserPO::getStatus, "1");
|
queryWrapper.eq(CsDeviceUserPO::getStatus, "1");
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param userId 这边放设备id
|
||||||
|
* @param list 这边放用户id集合
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean addRelation(UserDevParam param) {
|
||||||
|
String userIndex;
|
||||||
|
CsDeviceUserPO existingRecord = this.lambdaQuery()
|
||||||
|
.eq(CsDeviceUserPO::getDeviceId, param.getUserId())
|
||||||
|
.one();
|
||||||
|
|
||||||
|
if (existingRecord != null && Objects.equals(existingRecord.getPrimaryUserId(), existingRecord.getSubUserId())) {
|
||||||
|
userIndex = existingRecord.getPrimaryUserId();
|
||||||
|
} else {
|
||||||
|
userIndex = RequestUtil.getUserIndex();
|
||||||
|
if (userIndex == null) {
|
||||||
|
throw new IllegalArgumentException("当前用户信息获取失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
CsDeviceUserPO mainDeviceRelation = new CsDeviceUserPO();
|
||||||
|
mainDeviceRelation.setDeviceId(param.getUserId());
|
||||||
|
mainDeviceRelation.setPrimaryUserId(userIndex);
|
||||||
|
mainDeviceRelation.setSubUserId(userIndex);
|
||||||
|
mainDeviceRelation.setStatus("1");
|
||||||
|
boolean mainSaveSuccess = this.save(mainDeviceRelation);
|
||||||
|
if (!mainSaveSuccess) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(param.getList())) {
|
||||||
|
List<CsDeviceUserPO> batchRecords = param.getList().stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(item -> !Objects.equals(item, userIndex))
|
||||||
|
.map(item -> {
|
||||||
|
CsDeviceUserPO relation = new CsDeviceUserPO();
|
||||||
|
relation.setDeviceId(param.getUserId());
|
||||||
|
relation.setPrimaryUserId(userIndex);
|
||||||
|
relation.setSubUserId(item);
|
||||||
|
relation.setStatus("1");
|
||||||
|
return relation;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (!batchRecords.isEmpty()) {
|
||||||
|
return this.saveBatch(batchRecords);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -42,7 +43,9 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
|||||||
public boolean addEdData(CsEdDataAddParm csEdDataAddParm) {
|
public boolean addEdData(CsEdDataAddParm csEdDataAddParm) {
|
||||||
CsEdDataPO csEdDataPO = new CsEdDataPO();
|
CsEdDataPO csEdDataPO = new CsEdDataPO();
|
||||||
BeanUtils.copyProperties(csEdDataAddParm, csEdDataPO);
|
BeanUtils.copyProperties(csEdDataAddParm, csEdDataPO);
|
||||||
String filePath = fileStorageUtil.uploadMultipart (csEdDataAddParm.getFile (), OssPath.EDDATA);
|
String remoteDir = StrUtil.SLASH + OssPath.EDDATA + csEdDataAddParm.getDevTypeName() + StrUtil.SLASH + csEdDataAddParm.getVersionNo() + StrUtil.SLASH;
|
||||||
|
String filePath = fileStorageUtil.uploadMultipart(csEdDataAddParm.getFile(), remoteDir, true);
|
||||||
|
csEdDataPO.setCrc(csEdDataAddParm.getCrcInfo());
|
||||||
csEdDataPO.setFilePath(filePath);
|
csEdDataPO.setFilePath(filePath);
|
||||||
csEdDataPO.setStatus("1");
|
csEdDataPO.setStatus("1");
|
||||||
boolean save = this.save(csEdDataPO);
|
boolean save = this.save(csEdDataPO);
|
||||||
@@ -55,7 +58,7 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
|||||||
CsEdDataPO csEdDataPO = new CsEdDataPO();
|
CsEdDataPO csEdDataPO = new CsEdDataPO();
|
||||||
BeanUtils.copyProperties(csEdDataAuditParm, csEdDataPO);
|
BeanUtils.copyProperties(csEdDataAuditParm, csEdDataPO);
|
||||||
if (!Objects.isNull(csEdDataAuditParm.getFile())) {
|
if (!Objects.isNull(csEdDataAuditParm.getFile())) {
|
||||||
String filePath = fileStorageUtil.uploadMultipart (csEdDataAuditParm.getFile (), OssPath.EDDATA);
|
String filePath = fileStorageUtil.uploadMultipart(csEdDataAuditParm.getFile(), StrUtil.SLASH + OssPath.EDDATA + csEdDataAuditParm.getDevTypeName() + StrUtil.SLASH + csEdDataAuditParm.getVersionNo() + StrUtil.SLASH, true);
|
||||||
csEdDataPO.setFilePath(filePath);
|
csEdDataPO.setFilePath(filePath);
|
||||||
}
|
}
|
||||||
boolean b = this.updateById(csEdDataPO);
|
boolean b = this.updateById(csEdDataPO);
|
||||||
@@ -84,5 +87,11 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
|||||||
BeanUtils.copyProperties(csEdDataPo, csEdDataVo);
|
BeanUtils.copyProperties(csEdDataPo, csEdDataVo);
|
||||||
return csEdDataVo;
|
return csEdDataVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CsEdDataPO findByDevTypeIdAndVersionNo(String devTypeId, String versionNo) {
|
||||||
|
return this.lambdaQuery().eq(CsEdDataPO::getDevType, devTypeId)
|
||||||
|
.eq(CsEdDataPO::getVersionNo, versionNo)
|
||||||
|
.eq(CsEdDataPO::getStatus, 1).one();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
|||||||
if(StringUtils.isNotBlank(csEngineeringAuditParm.getName())){
|
if(StringUtils.isNotBlank(csEngineeringAuditParm.getName())){
|
||||||
csLedger1.setName(csEngineeringAuditParm.getName());
|
csLedger1.setName(csEngineeringAuditParm.getName());
|
||||||
}
|
}
|
||||||
|
csLedger1.setSort(csEngineeringAuditParm.getSort());
|
||||||
csLedgerMapper.updateById(csLedger1);
|
csLedgerMapper.updateById(csLedger1);
|
||||||
List<CsEngineeringPO> list = this.lambdaQuery().eq(CsEngineeringPO::getName, csEngineeringAuditParm.getName()).eq(CsEngineeringPO::getStatus, "1").list();
|
List<CsEngineeringPO> list = this.lambdaQuery().eq(CsEngineeringPO::getName, csEngineeringAuditParm.getName()).eq(CsEngineeringPO::getStatus, "1").list();
|
||||||
if(list.size()>1){
|
if(list.size()>1){
|
||||||
|
|||||||
@@ -5,15 +5,17 @@ import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
|||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.text.StrPool;
|
import cn.hutool.core.text.StrPool;
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
@@ -22,28 +24,32 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.access.api.AskDeviceDataFeignClient;
|
import com.njcn.access.api.AskDeviceDataFeignClient;
|
||||||
import com.njcn.access.utils.MqttUtil;
|
import com.njcn.access.utils.MqttUtil;
|
||||||
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.api.CsLogsFeignClient;
|
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||||
import com.njcn.csdevice.mapper.CsSoftInfoMapper;
|
import com.njcn.csdevice.mapper.CsSoftInfoMapper;
|
||||||
import com.njcn.csdevice.mapper.CsTerminalLogsMapper;
|
import com.njcn.csdevice.mapper.CsTerminalLogsMapper;
|
||||||
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
import com.njcn.csdevice.pojo.param.*;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DevVersionVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||||
import com.njcn.csdevice.service.*;
|
import com.njcn.csdevice.service.*;
|
||||||
import com.njcn.csdevice.util.QRCodeUtil;
|
import com.njcn.csdevice.util.QRCodeUtil;
|
||||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||||
import com.njcn.csdevice.utils.StringUtil;
|
import com.njcn.csdevice.utils.StringUtil;
|
||||||
|
import com.njcn.csharmonic.api.CsHarmonicPlanLineFeignClient;
|
||||||
import com.njcn.csharmonic.api.EventUserFeignClient;
|
import com.njcn.csharmonic.api.EventUserFeignClient;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
|
import com.njcn.cssystem.api.CsLogsFeignClient;
|
||||||
|
import com.njcn.device.biz.mapper.OverLimitWlMapper;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||||
@@ -54,7 +60,10 @@ import com.njcn.system.enums.DicDataEnum;
|
|||||||
import com.njcn.system.enums.DicDataTypeEnum;
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||||
|
import com.njcn.user.api.UserFeignClient;
|
||||||
import com.njcn.user.enums.AppRoleEnum;
|
import com.njcn.user.enums.AppRoleEnum;
|
||||||
|
import com.njcn.user.pojo.po.User;
|
||||||
|
import com.njcn.web.factory.PageFactory;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@@ -76,8 +85,8 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
* Date: 2023/3/30 16:23【需求编号】
|
* Date: 2023/3/30 16:23【需求编号】
|
||||||
@@ -111,7 +120,15 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
||||||
private final ICsCommunicateService csCommunicateService;
|
private final ICsCommunicateService csCommunicateService;
|
||||||
private final ICsUserPinsService csUserPinsService;
|
private final ICsUserPinsService csUserPinsService;
|
||||||
|
private final CsEngineeringService csEngineeringService;
|
||||||
|
private final AppProjectService appProjectService;
|
||||||
|
private final CsEdDataService csEdDataService;
|
||||||
|
private final ICsSoftInfoService csSoftInfoService;
|
||||||
private final EventUserFeignClient eventUserFeignClient;
|
private final EventUserFeignClient eventUserFeignClient;
|
||||||
|
private final UserFeignClient userFeignClient;
|
||||||
|
private final OverLimitWlMapper overLimitWlMapper;
|
||||||
|
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||||
|
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshDeviceDataCache() {
|
public void refreshDeviceDataCache() {
|
||||||
@@ -125,11 +142,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
public CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||||
boolean result;
|
boolean result;
|
||||||
List<CsEquipmentDeliveryPO> one = this.lambdaQuery()
|
List<CsEquipmentDeliveryPO> one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAddParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).eq(CsEquipmentDeliveryPO::getDevAccessMethod, "MQTT").list();
|
||||||
.eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAddParm.getName())
|
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus, 0)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getDevAccessMethod, "MQTT")
|
|
||||||
.list();
|
|
||||||
if (CollUtil.isNotEmpty(one)) {
|
if (CollUtil.isNotEmpty(one)) {
|
||||||
throw new BusinessException("设备名称不能重复");
|
throw new BusinessException("设备名称不能重复");
|
||||||
}
|
}
|
||||||
@@ -182,7 +195,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@DSTransactional
|
||||||
public Boolean AuditEquipmentDelivery(String id) {
|
public Boolean AuditEquipmentDelivery(String id) {
|
||||||
//物理删除
|
//物理删除
|
||||||
boolean update = false;
|
boolean update = false;
|
||||||
@@ -193,13 +206,18 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
update = this.remove(wrapper);
|
update = this.remove(wrapper);
|
||||||
redisUtil.deleteKeysByString(AppRedisKey.LINE_POSITION + po.getNdid());
|
redisUtil.deleteKeysByString(AppRedisKey.LINE_POSITION + po.getNdid());
|
||||||
}
|
}
|
||||||
//删除监测点表、监测点拓扑图关系
|
//删除监测点表、监测点拓扑图关系、监测点限值
|
||||||
List<CsLedger> list = csLedgerService.lambdaQuery().eq(CsLedger::getPid, id).list();
|
List<CsLedger> list = csLedgerService.lambdaQuery().eq(CsLedger::getPid, id).list();
|
||||||
if (!CollectionUtils.isEmpty(list)) {
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
List<String> collect = list.stream().map(CsLedger::getId).collect(Collectors.toList());
|
List<String> collect = list.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||||
LambdaQueryWrapper<CsLinePO> csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsLinePO> csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId, collect);
|
csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId, collect);
|
||||||
csLinePOService.remove(csLinePOLambdaQueryWrapper);
|
csLinePOService.remove(csLinePOLambdaQueryWrapper);
|
||||||
|
//删除监测点限值
|
||||||
|
overLimitWlMapper.deleteBatchIds(collect);
|
||||||
|
//删除配置
|
||||||
|
csHarmonicPlanLineFeignClient.deleteByLineIds(collect);
|
||||||
|
|
||||||
QueryWrapper<AppLineTopologyDiagramPO> appLineTopologyDiagramPOQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<AppLineTopologyDiagramPO> appLineTopologyDiagramPOQueryWrapper = new QueryWrapper<>();
|
||||||
appLineTopologyDiagramPOQueryWrapper.clear();
|
appLineTopologyDiagramPOQueryWrapper.clear();
|
||||||
appLineTopologyDiagramPOQueryWrapper.in("line_id", collect);
|
appLineTopologyDiagramPOQueryWrapper.in("line_id", collect);
|
||||||
@@ -242,10 +260,16 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
BeanUtils.copyProperties(csEquipmentDeliveryPO, result);
|
BeanUtils.copyProperties(csEquipmentDeliveryPO, result);
|
||||||
if (!Objects.isNull(csEquipmentDeliveryPO.getAssociatedEngineering()) && !Objects.equals(csEquipmentDeliveryPO.getAssociatedEngineering(), "")) {
|
if (!Objects.isNull(csEquipmentDeliveryPO.getAssociatedEngineering()) && !Objects.equals(csEquipmentDeliveryPO.getAssociatedEngineering(), "")) {
|
||||||
result.setAssociatedEngineeringName(csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedEngineering()).getName());
|
CsLedger csLedger = csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedEngineering());
|
||||||
|
if (!Objects.isNull(csLedger)) {
|
||||||
|
result.setAssociatedEngineeringName(csLedger.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!Objects.isNull(csEquipmentDeliveryPO.getAssociatedProject()) && !Objects.equals(csEquipmentDeliveryPO.getAssociatedProject(), "")) {
|
if (!Objects.isNull(csEquipmentDeliveryPO.getAssociatedProject()) && !Objects.equals(csEquipmentDeliveryPO.getAssociatedProject(), "")) {
|
||||||
result.setAssociatedProjectName(csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedProject()).getName());
|
CsLedger csLedger = csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedProject());
|
||||||
|
if (!Objects.isNull(csLedger)) {
|
||||||
|
result.setAssociatedProjectName(csLedger.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -275,10 +299,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
param.setEndTime(LocalDateTime.now().format(DatePattern.NORM_DATETIME_FORMATTER));
|
param.setEndTime(LocalDateTime.now().format(DatePattern.NORM_DATETIME_FORMATTER));
|
||||||
param.setEventIds(lineIds.stream().map(CsLinePO::getLineId).collect(Collectors.toList()));
|
param.setEventIds(lineIds.stream().map(CsLinePO::getLineId).collect(Collectors.toList()));
|
||||||
List<CsEventPO> eventList = eventUserFeignClient.queryTempEventDetail(param).getData();
|
List<CsEventPO> eventList = eventUserFeignClient.queryTempEventDetail(param).getData();
|
||||||
Map<String, List<CsEventPO>> eventMap = Optional.ofNullable(eventList)
|
Map<String, List<CsEventPO>> eventMap = Optional.ofNullable(eventList).orElse(Collections.emptyList()).stream().collect(Collectors.groupingBy(CsEventPO::getDeviceId));
|
||||||
.orElse(Collections.emptyList())
|
|
||||||
.stream()
|
|
||||||
.collect(Collectors.groupingBy(CsEventPO::getDeviceId));
|
|
||||||
|
|
||||||
List<ProjectEquipmentVO> recordList = new ArrayList<>();
|
List<ProjectEquipmentVO> recordList = new ArrayList<>();
|
||||||
list.getRecords().forEach(temp -> {
|
list.getRecords().forEach(temp -> {
|
||||||
@@ -296,10 +317,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
|
|
||||||
//获取用户置顶的设备
|
//获取用户置顶的设备
|
||||||
List<CsUserPins> topList = csUserPinsService.getPinToTopList();
|
List<CsUserPins> topList = csUserPinsService.getPinToTopList();
|
||||||
List<String> targetIdList = topList.stream()
|
List<String> targetIdList = topList.stream().filter(item -> Objects.equals(item.getTargetType(), 1)).map(CsUserPins::getTargetId).collect(Collectors.toList());
|
||||||
.filter(item -> Objects.equals(item.getTargetType(), 1))
|
|
||||||
.map(CsUserPins::getTargetId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (CollectionUtil.isNotEmpty(targetIdList)) {
|
if (CollectionUtil.isNotEmpty(targetIdList)) {
|
||||||
List<ProjectEquipmentVO> matchedList = new ArrayList<>();
|
List<ProjectEquipmentVO> matchedList = new ArrayList<>();
|
||||||
List<ProjectEquipmentVO> unmatchedList = new ArrayList<>();
|
List<ProjectEquipmentVO> unmatchedList = new ArrayList<>();
|
||||||
@@ -330,9 +348,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAuditParm.getNdid());
|
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAuditParm.getNdid());
|
||||||
boolean result;
|
boolean result;
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid())
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).in(CsEquipmentDeliveryPO::getStatus, Arrays.asList(1, 2, 3)).ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
||||||
.in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3))
|
|
||||||
.ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
|
||||||
int countByAccount = this.count(lambdaQueryWrapper);
|
int countByAccount = this.count(lambdaQueryWrapper);
|
||||||
//大于等于1个则表示重复
|
//大于等于1个则表示重复
|
||||||
if (countByAccount >= 1) {
|
if (countByAccount >= 1) {
|
||||||
@@ -341,11 +357,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
||||||
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
||||||
List<CsEquipmentDeliveryPO> list = this.lambdaQuery()
|
List<CsEquipmentDeliveryPO> list = this.lambdaQuery().ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId()).ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||||
.ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId())
|
|
||||||
.ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid())
|
|
||||||
.eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName())
|
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
|
||||||
if (!CollectionUtils.isEmpty(list)) {
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
throw new BusinessException("设备名称不能重复");
|
throw new BusinessException("设备名称不能重复");
|
||||||
}
|
}
|
||||||
@@ -360,17 +372,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
csLedgerParam.setName(csEquipmentDeliveryAuditParm.getName());
|
csLedgerParam.setName(csEquipmentDeliveryAuditParm.getName());
|
||||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||||
}
|
}
|
||||||
if (result) {
|
|
||||||
refreshDeviceDataCache();
|
|
||||||
if (!Objects.equals(po.getUsageStatus(),csEquipmentDeliveryAuditParm.getUsageStatus())) {
|
|
||||||
DeviceLogDTO dto = new DeviceLogDTO();
|
|
||||||
dto.setUserName(RequestUtil.getUsername());
|
|
||||||
dto.setOperate("设备使用状态被修改");
|
|
||||||
dto.setResult(1);
|
|
||||||
dto.setLoginName(RequestUtil.getLoginName());
|
|
||||||
csLogsFeignClient.addUserLog(dto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,11 +415,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotNull(queryParam.getConnectStatus())) {
|
if (ObjectUtil.isNotNull(queryParam.getConnectStatus())) {
|
||||||
recordList = recordList.stream()
|
recordList = recordList.stream().filter(item -> queryParam.getConnectStatus() == 0 ? "未连接".equals(item.getConnectStatus()) : "已连接".equals(item.getConnectStatus())).collect(Collectors.toList());
|
||||||
.filter(item -> queryParam.getConnectStatus() == 0
|
|
||||||
? "未连接".equals(item.getConnectStatus())
|
|
||||||
: "已连接".equals(item.getConnectStatus()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
page.setTotal(CollectionUtil.isEmpty(recordList) ? 0 : recordList.size());
|
page.setTotal(CollectionUtil.isEmpty(recordList) ? 0 : recordList.size());
|
||||||
page.setRecords(recordList);
|
page.setRecords(recordList);
|
||||||
@@ -507,6 +504,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
dataSetVO.setName(item.getAnotherName());
|
dataSetVO.setName(item.getAnotherName());
|
||||||
dataSetVO.setType("rt");
|
dataSetVO.setType("rt");
|
||||||
dataSetList.add(dataSetVO);
|
dataSetList.add(dataSetVO);
|
||||||
|
dataSetVO.setSort(item.getIdx());
|
||||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -514,33 +512,39 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
boolean isPortableDevice = DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType());
|
boolean isPortableDevice = DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType());
|
||||||
boolean isCLdDevice = DicDataEnum.DEV_CLD.getCode().equals(dictTreeFeignClient.queryById(csEquipmentDeliveryPo.getDevType()).getData().getCode());
|
boolean isCLdDevice = DicDataEnum.DEV_CLD.getCode().equals(dictTreeFeignClient.queryById(csEquipmentDeliveryPo.getDevType()).getData().getCode());
|
||||||
|
|
||||||
addDataSet(dataSetList, item, "最新数据", "rt");
|
addDataSet(dataSetList, item, "最新数据", "rt",0);
|
||||||
addDataSet(dataSetList, item, "历史统计数据", "history");
|
|
||||||
addDataSet(dataSetList, item, "历史趋势", "trenddata");
|
|
||||||
if (item.getClDev() == 0 && item.getType() == 0) {
|
if (item.getClDev() == 0 && item.getType() == 0) {
|
||||||
//限制角色展示
|
//限制角色展示
|
||||||
String role = RequestUtil.getUserRole();
|
String role = RequestUtil.getUserRole();
|
||||||
List<String> strings = JSONArray.parseArray(role, String.class);
|
List<String> strings = JSONArray.parseArray(role, String.class);
|
||||||
if (strings.contains(AppRoleEnum.ENGINEERING_USER.getCode())
|
if (strings.contains(AppRoleEnum.ENGINEERING_USER.getCode()) || strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode()) || strings.contains(AppRoleEnum.ROOT.getCode())) {
|
||||||
|| strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode())
|
addDataSet(dataSetList, item, "模块数据", "moduleData",3);
|
||||||
|| strings.contains(AppRoleEnum.ROOT.getCode())) {
|
|
||||||
addDataSet(dataSetList, item, "模块数据", "moduleData");
|
|
||||||
}
|
}
|
||||||
|
addDataSet(dataSetList, item, "历史数据", "trenddata",2);
|
||||||
|
addDataSet(dataSetList, item, "暂态数据", "event",4);
|
||||||
|
addDataSet(dataSetList, item, "运行数据", "devRunTrend",5);
|
||||||
|
} else {
|
||||||
|
addDataSet(dataSetList, item, "实时数据", "realtimedata",1);
|
||||||
|
addDataSet(dataSetList, item, "历史数据", "trenddata",2);
|
||||||
|
addDataSet(dataSetList, item, "暂态数据", "event",4);
|
||||||
|
addDataSet(dataSetList, item, "运行数据", "devRunTrend",5);
|
||||||
|
addDataSet(dataSetList, item, "电度数据", "kilowattHour",6);
|
||||||
}
|
}
|
||||||
if (isPortableDevice) {
|
if (isPortableDevice) {
|
||||||
// 便携式设备特有的数据集
|
// 便携式设备特有的数据集
|
||||||
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
addDataSet(dataSetList, item, "测试项数据", "items",7);
|
||||||
addDataSet(dataSetList, item, "暂态事件", "event");
|
|
||||||
addDataSet(dataSetList, item, "测试项日志", "items");
|
|
||||||
}
|
}
|
||||||
if (isCLdDevice) {
|
// if (isCLdDevice) {
|
||||||
// 云前置数据集
|
// // 云前置数据集
|
||||||
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
// addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
||||||
addDataSet(dataSetList, item, "暂态事件", "event");
|
// addDataSet(dataSetList, item, "暂态数据", "event");
|
||||||
}
|
// }
|
||||||
addDataSet(dataSetList, item, "运行趋势", "devRunTrend");
|
|
||||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||||
}
|
}
|
||||||
|
if (CollUtil.isNotEmpty(dataSetList)) {
|
||||||
|
dataSetList.sort(Comparator.comparing(DeviceManagerVO.DataSetVO::getSort));
|
||||||
|
}
|
||||||
deviceManagerVo.setDataSetList(dataSetList);
|
deviceManagerVo.setDataSetList(dataSetList);
|
||||||
List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
|
List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
|
||||||
if (!csLinePOS.isEmpty()) {
|
if (!csLinePOS.isEmpty()) {
|
||||||
@@ -550,11 +554,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDataSet(List<DeviceManagerVO.DataSetVO> dataSetList, CsDataSet item, String name, String type) {
|
private void addDataSet(List<DeviceManagerVO.DataSetVO> dataSetList, CsDataSet item, String name, String type, Integer sort) {
|
||||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||||
dataSetVO.setId(item.getId());
|
dataSetVO.setId(item.getId());
|
||||||
dataSetVO.setName(name);
|
dataSetVO.setName(name);
|
||||||
dataSetVO.setType(type);
|
dataSetVO.setType(type);
|
||||||
|
dataSetVO.setSort(sort);
|
||||||
dataSetList.add(dataSetVO);
|
dataSetList.add(dataSetVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -694,7 +699,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
* 6.删除cs_device_user
|
* 6.删除cs_device_user
|
||||||
* */
|
* */
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@DSTransactional
|
||||||
public void delete(String devId) {
|
public void delete(String devId) {
|
||||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||||
/**
|
/**
|
||||||
@@ -721,6 +726,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
csLinePOQueryWrapper.clear();
|
csLinePOQueryWrapper.clear();
|
||||||
csLinePOQueryWrapper.in("line_id", collect);
|
csLinePOQueryWrapper.in("line_id", collect);
|
||||||
csLinePOService.remove(csLinePOQueryWrapper);
|
csLinePOService.remove(csLinePOQueryWrapper);
|
||||||
|
//删除监测点限值
|
||||||
|
overLimitWlMapper.deleteBatchIds(collect);
|
||||||
|
|
||||||
QueryWrapper<AppLineTopologyDiagramPO> appLineTopologyDiagramPOQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<AppLineTopologyDiagramPO> appLineTopologyDiagramPOQueryWrapper = new QueryWrapper<>();
|
||||||
appLineTopologyDiagramPOQueryWrapper.clear();
|
appLineTopologyDiagramPOQueryWrapper.clear();
|
||||||
appLineTopologyDiagramPOQueryWrapper.in("line_id", collect);
|
appLineTopologyDiagramPOQueryWrapper.in("line_id", collect);
|
||||||
@@ -733,20 +741,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void testCompletion(String deviceId, Integer type, String remark) {
|
public void testCompletion(String deviceId, Integer type, String remark) {
|
||||||
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
|
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
|
||||||
this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId,deviceId).
|
this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId, deviceId).set(CsEquipmentDeliveryPO::getStatus, 1).set(CsEquipmentDeliveryPO::getRunStatus, 1).set(CsEquipmentDeliveryPO::getProcess, type + 1).update();
|
||||||
set(CsEquipmentDeliveryPO::getStatus,1).
|
|
||||||
set(CsEquipmentDeliveryPO::getRunStatus,1).
|
|
||||||
set(CsEquipmentDeliveryPO::getProcess,type+1).update();
|
|
||||||
this.delete(deviceId);
|
this.delete(deviceId);
|
||||||
List<CsEquipmentProcessPO> list = csEquipmentProcessPOService.lambdaQuery().eq(CsEquipmentProcessPO::getDevId, one.getNdid()).
|
List<CsEquipmentProcessPO> list = csEquipmentProcessPOService.lambdaQuery().eq(CsEquipmentProcessPO::getDevId, one.getNdid()).eq(CsEquipmentProcessPO::getProcess, type).orderByDesc(CsEquipmentProcessPO::getStartTime).list();
|
||||||
eq(CsEquipmentProcessPO::getProcess, type).orderByDesc(CsEquipmentProcessPO::getStartTime).list();
|
|
||||||
//获取最新一条数据;
|
//获取最新一条数据;
|
||||||
CsEquipmentProcessPO csEquipmentProcessPO = list.get(0);
|
CsEquipmentProcessPO csEquipmentProcessPO = list.get(0);
|
||||||
csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getId,csEquipmentProcessPO.getId()).
|
csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getId, csEquipmentProcessPO.getId()).set(CsEquipmentProcessPO::getStatus, 1).set(CsEquipmentProcessPO::getEndTime, LocalDateTime.now()).set(CsEquipmentProcessPO::getRemark, remark).update();
|
||||||
set(CsEquipmentProcessPO::getStatus,1).
|
|
||||||
set(CsEquipmentProcessPO::getEndTime,LocalDateTime.now()).
|
|
||||||
set(CsEquipmentProcessPO::getRemark,remark).
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -757,24 +757,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
// set(CsEquipmentDeliveryPO::getRunStatus,1).
|
// set(CsEquipmentDeliveryPO::getRunStatus,1).
|
||||||
set(CsEquipmentDeliveryPO::getProcess, type).update();
|
set(CsEquipmentDeliveryPO::getProcess, type).update();
|
||||||
this.delete(deviceId);
|
this.delete(deviceId);
|
||||||
List<CsEquipmentProcessPO> list = csEquipmentProcessPOService.lambdaQuery().eq(CsEquipmentProcessPO::getDevId, one.getNdid()).
|
List<CsEquipmentProcessPO> list = csEquipmentProcessPOService.lambdaQuery().eq(CsEquipmentProcessPO::getDevId, one.getNdid()).eq(CsEquipmentProcessPO::getProcess, type).orderByDesc(CsEquipmentProcessPO::getStartTime).list();
|
||||||
eq(CsEquipmentProcessPO::getProcess, type).orderByDesc(CsEquipmentProcessPO::getStartTime).list();
|
|
||||||
//获取最新一条数据;
|
//获取最新一条数据;
|
||||||
CsEquipmentProcessPO csEquipmentProcessPO = list.get(0);
|
CsEquipmentProcessPO csEquipmentProcessPO = list.get(0);
|
||||||
csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getId,csEquipmentProcessPO.getId()).
|
csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getId, csEquipmentProcessPO.getId()).set(CsEquipmentProcessPO::getStatus, 0).set(CsEquipmentProcessPO::getEndTime, LocalDateTime.now()).set(CsEquipmentProcessPO::getRemark, remark).update();
|
||||||
set(CsEquipmentProcessPO::getStatus,0).
|
|
||||||
set(CsEquipmentProcessPO::getEndTime,LocalDateTime.now()).
|
|
||||||
set(CsEquipmentProcessPO::getRemark,remark).
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSoftInfo(String nDid, String id) {
|
public void updateSoftInfo(String nDid, String id) {
|
||||||
boolean result;
|
boolean result;
|
||||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
|
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid, nDid).ne(CsEquipmentDeliveryPO::getRunStatus, 0).set(CsEquipmentDeliveryPO::getSoftinfoId, id);
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
|
||||||
.set(CsEquipmentDeliveryPO::getSoftinfoId,id);
|
|
||||||
result = this.update(lambdaUpdateWrapper);
|
result = this.update(lambdaUpdateWrapper);
|
||||||
if (result) {
|
if (result) {
|
||||||
refreshDeviceDataCache();
|
refreshDeviceDataCache();
|
||||||
@@ -785,9 +778,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
public void updateModuleNumber(String nDid, Integer number) {
|
public void updateModuleNumber(String nDid, Integer number) {
|
||||||
boolean result;
|
boolean result;
|
||||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
|
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid, nDid).ne(CsEquipmentDeliveryPO::getRunStatus, 0).set(CsEquipmentDeliveryPO::getModuleNumber, number);
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
|
||||||
.set(CsEquipmentDeliveryPO::getModuleNumber,number);
|
|
||||||
result = this.update(lambdaUpdateWrapper);
|
result = this.update(lambdaUpdateWrapper);
|
||||||
if (result) {
|
if (result) {
|
||||||
refreshDeviceDataCache();
|
refreshDeviceDataCache();
|
||||||
@@ -821,11 +812,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsEquipmentDeliveryPO> getAllOnline() {
|
public List<CsEquipmentDeliveryPO> getAllOnline() {
|
||||||
return this.lambdaQuery()
|
return this.lambdaQuery().ne(CsEquipmentDeliveryPO::getRunStatus, 0).eq(CsEquipmentDeliveryPO::getUsageStatus, 1).isNotNull(CsEquipmentDeliveryPO::getNodeId).list();
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1)
|
|
||||||
.isNotNull(CsEquipmentDeliveryPO::getNodeId)
|
|
||||||
.list();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -896,8 +883,28 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
csLedger.setSort(0);
|
csLedger.setSort(0);
|
||||||
int addLedger = csLedgerMapper.insert(csLedger);
|
int addLedger = csLedgerMapper.insert(csLedger);
|
||||||
|
|
||||||
//谁新建的设备,则认为是该设备的主用户,新建用户设备关系表数据
|
//1.谁新建的设备,则认为是该设备的主用户,新建用户设备关系表数据
|
||||||
boolean addUser = csDeviceUserPOService.add(csEquipmentDeliveryPo.getId());
|
//2.获取当前工程已经关注的用户列表,新增用户和设备的关系
|
||||||
|
boolean addUser = false;
|
||||||
|
List<DevDetailDTO> devDetailList = csLedgerFeignClient.getDevInfoByEngineerIds(Collections.singletonList(param.getEngineeringId())).getData();
|
||||||
|
if (!CollectionUtils.isEmpty(devDetailList)) {
|
||||||
|
List<String> devIds = devDetailList.stream().map(DevDetailDTO::getEquipmentId).collect(Collectors.toList());
|
||||||
|
LambdaQueryWrapper<CsDeviceUserPO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.in(CsDeviceUserPO::getDeviceId, devIds);
|
||||||
|
List<CsDeviceUserPO> csDeviceUserPOList = csDeviceUserPOService.list(wrapper);
|
||||||
|
if (!CollectionUtils.isEmpty(csDeviceUserPOList)) {
|
||||||
|
List<String> userIds = csDeviceUserPOList.stream().map(CsDeviceUserPO::getSubUserId).distinct().collect(Collectors.toList());
|
||||||
|
UserDevParam param1 = new UserDevParam();
|
||||||
|
param1.setUserId(csEquipmentDeliveryPo.getId());
|
||||||
|
param1.setList(userIds);
|
||||||
|
addUser = csDeviceUserPOService.addRelation(param1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
UserDevParam param1 = new UserDevParam();
|
||||||
|
param1.setUserId(csEquipmentDeliveryPo.getId());
|
||||||
|
param1.setList(null);
|
||||||
|
addUser = csDeviceUserPOService.addRelation(param1);
|
||||||
|
}
|
||||||
|
|
||||||
if (result && ObjectUtil.isNotNull(relation) && addLedger > 0 && addUser) {
|
if (result && ObjectUtil.isNotNull(relation) && addLedger > 0 && addUser) {
|
||||||
refreshDeviceDataCache();
|
refreshDeviceDataCache();
|
||||||
@@ -906,7 +913,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@DSTransactional
|
||||||
public Boolean delCldDev(String id) {
|
public Boolean delCldDev(String id) {
|
||||||
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, id).one();
|
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, id).one();
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
@@ -918,6 +925,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
LambdaQueryWrapper<CsLinePO> csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsLinePO> csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId, collect);
|
csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId, collect);
|
||||||
csLinePOService.remove(csLinePOLambdaQueryWrapper);
|
csLinePOService.remove(csLinePOLambdaQueryWrapper);
|
||||||
|
//删除监测点限值
|
||||||
|
overLimitWlMapper.deleteBatchIds(collect);
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<CsLedger> csLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsLedger> csLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
csLedgerLambdaQueryWrapper.clear();
|
csLedgerLambdaQueryWrapper.clear();
|
||||||
@@ -930,9 +939,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
if (update) {
|
if (update) {
|
||||||
refreshDeviceDataCache();
|
refreshDeviceDataCache();
|
||||||
}
|
}
|
||||||
|
//删除用户设备关系表数据
|
||||||
|
LambdaQueryWrapper<CsDeviceUserPO> csDeviceUserPOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
csDeviceUserPOLambdaQueryWrapper.eq(CsDeviceUserPO::getDeviceId, id);
|
||||||
|
csDeviceUserPOService.remove(csDeviceUserPOLambdaQueryWrapper);
|
||||||
//新增操作日志
|
//新增操作日志
|
||||||
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||||
csTerminalLogs.setId(IdUtil.simpleUUID());
|
|
||||||
csTerminalLogs.setDeviceId(id);
|
csTerminalLogs.setDeviceId(id);
|
||||||
csTerminalLogs.setOperateType(2);
|
csTerminalLogs.setOperateType(2);
|
||||||
csTerminalLogs.setIsPush(0);
|
csTerminalLogs.setIsPush(0);
|
||||||
@@ -959,9 +971,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
StringUtil.containsSpecialCharacters(param.getNdid());
|
StringUtil.containsSpecialCharacters(param.getNdid());
|
||||||
boolean result;
|
boolean result;
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,param.getNdid())
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid, param.getNdid()).in(CsEquipmentDeliveryPO::getStatus, Arrays.asList(1, 2, 3)).ne(CsEquipmentDeliveryPO::getId, param.getId());
|
||||||
.in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3))
|
|
||||||
.ne(CsEquipmentDeliveryPO::getId, param.getId());
|
|
||||||
int countByAccount = this.count(lambdaQueryWrapper);
|
int countByAccount = this.count(lambdaQueryWrapper);
|
||||||
//大于等于1个则表示重复
|
//大于等于1个则表示重复
|
||||||
if (countByAccount >= 1) {
|
if (countByAccount >= 1) {
|
||||||
@@ -970,11 +980,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, param.getId());
|
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, param.getId());
|
||||||
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
||||||
List<CsEquipmentDeliveryPO> list = this.lambdaQuery()
|
List<CsEquipmentDeliveryPO> list = this.lambdaQuery().ne(CsEquipmentDeliveryPO::getId, param.getId()).ne(CsEquipmentDeliveryPO::getNdid, param.getNdid()).eq(CsEquipmentDeliveryPO::getName, param.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||||
.ne(CsEquipmentDeliveryPO::getId, param.getId())
|
|
||||||
.ne(CsEquipmentDeliveryPO::getNdid, param.getNdid())
|
|
||||||
.eq(CsEquipmentDeliveryPO::getName, param.getName())
|
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
|
||||||
if (!CollectionUtils.isEmpty(list)) {
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
throw new BusinessException("设备名称不能重复");
|
throw new BusinessException("设备名称不能重复");
|
||||||
}
|
}
|
||||||
@@ -991,17 +997,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
csLedgerParam.setName(param.getName());
|
csLedgerParam.setName(param.getName());
|
||||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||||
}
|
}
|
||||||
if (result) {
|
|
||||||
refreshDeviceDataCache();
|
|
||||||
if (!Objects.equals(po.getUsageStatus(),param.getUsageStatus())) {
|
|
||||||
DeviceLogDTO dto = new DeviceLogDTO();
|
|
||||||
dto.setUserName(RequestUtil.getUsername());
|
|
||||||
dto.setOperate("设备使用状态被修改");
|
|
||||||
dto.setResult(1);
|
|
||||||
dto.setLoginName(RequestUtil.getLoginName());
|
|
||||||
csLogsFeignClient.addUserLog(dto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//新增台账日志
|
//新增台账日志
|
||||||
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||||
csTerminalLogs.setDeviceId(csEquipmentDeliveryPo.getId());
|
csTerminalLogs.setDeviceId(csEquipmentDeliveryPo.getId());
|
||||||
@@ -1026,9 +1021,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
state.add(9);
|
state.add(9);
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,id)
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId, id).in(ObjectUtil.isNotEmpty(state), CsEquipmentDeliveryPO::getUsageStatus, state).eq(CsEquipmentDeliveryPO::getDevAccessMethod, "CLD");
|
||||||
.in(ObjectUtil.isNotEmpty(state),CsEquipmentDeliveryPO::getUsageStatus,state)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getDevAccessMethod,"CLD");
|
|
||||||
return this.list(lambdaQueryWrapper);
|
return this.list(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1037,10 +1030,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
public void updateCldDevStatus(String nodeId, Integer processNo) {
|
public void updateCldDevStatus(String nodeId, Integer processNo) {
|
||||||
//获取需要修改的设备信息
|
//获取需要修改的设备信息
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId)
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId, nodeId).eq(CsEquipmentDeliveryPO::getNodeProcess, processNo).eq(CsEquipmentDeliveryPO::getUsageStatus, 1).eq(CsEquipmentDeliveryPO::getRunStatus, 2);
|
||||||
.eq(CsEquipmentDeliveryPO::getNodeProcess,processNo)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getRunStatus,2);
|
|
||||||
List<CsEquipmentDeliveryPO> devList = this.list(lambdaQueryWrapper);
|
List<CsEquipmentDeliveryPO> devList = this.list(lambdaQueryWrapper);
|
||||||
if (CollectionUtil.isNotEmpty(devList)) {
|
if (CollectionUtil.isNotEmpty(devList)) {
|
||||||
//修改设备运行状态
|
//修改设备运行状态
|
||||||
@@ -1056,9 +1046,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void flipCldDevStatus(String time, String devId, Integer status) {
|
public void flipCldDevStatus(String time, String devId, Integer status) {
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId,devId)
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId, devId).eq(CsEquipmentDeliveryPO::getUsageStatus, 1).ne(CsEquipmentDeliveryPO::getUsageStatus, 0);
|
||||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1)
|
|
||||||
.ne(CsEquipmentDeliveryPO::getUsageStatus,0);
|
|
||||||
CsEquipmentDeliveryPO po = this.getOne(lambdaQueryWrapper);
|
CsEquipmentDeliveryPO po = this.getOne(lambdaQueryWrapper);
|
||||||
if (ObjectUtil.isNotNull(po)) {
|
if (ObjectUtil.isNotNull(po)) {
|
||||||
po.setRunStatus(status);
|
po.setRunStatus(status);
|
||||||
@@ -1094,9 +1082,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
@Override
|
@Override
|
||||||
public List<CsEquipmentDeliveryPO> getDataByNodeIdAndProcessNo(String nodeId, Integer processNo) {
|
public List<CsEquipmentDeliveryPO> getDataByNodeIdAndProcessNo(String nodeId, Integer processNo) {
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId)
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId, nodeId).ne(CsEquipmentDeliveryPO::getRunStatus, 0).eq(CsEquipmentDeliveryPO::getDevAccessMethod, "CLD");
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getDevAccessMethod,"CLD");
|
|
||||||
if (ObjectUtil.isNotNull(processNo)) {
|
if (ObjectUtil.isNotNull(processNo)) {
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeProcess, processNo);
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeProcess, processNo);
|
||||||
}
|
}
|
||||||
@@ -1108,6 +1094,77 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId, devList).list();
|
return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId, devList).list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<DevVersionVO> versionPage(CsEquipmentDeliveryQueryParm baseParam) {
|
||||||
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.ne(CsEquipmentDeliveryPO::getRunStatus, 0)
|
||||||
|
.eq(StrUtil.isNotBlank(baseParam.getDevModel()), CsEquipmentDeliveryPO::getDevModel, baseParam.getDevModel())
|
||||||
|
.eq(StrUtil.isNotBlank(baseParam.getIcd()), CsEquipmentDeliveryPO::getIcd, baseParam.getIcd())
|
||||||
|
.eq(ObjectUtil.isNotNull(baseParam.getUpgrade()), CsEquipmentDeliveryPO::getUpgrade, baseParam.getUpgrade())
|
||||||
|
.like(StrUtil.isNotBlank(baseParam.getSearchValue()), CsEquipmentDeliveryPO::getName, baseParam.getSearchValue());
|
||||||
|
Page<CsEquipmentDeliveryPO> page = this.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), wrapper);
|
||||||
|
|
||||||
|
List<DevVersionVO> records = new ArrayList<>();
|
||||||
|
List<DevVersionVO> finalRecords = records;
|
||||||
|
page.getRecords().forEach(item -> {
|
||||||
|
DevVersionVO devVersionVO = BeanUtil.copyProperties(item, DevVersionVO.class);
|
||||||
|
List<User> userData = userFeignClient.getUserByIdList(Collections.singletonList(item.getUpdateBy())).getData();
|
||||||
|
if (CollectionUtil.isNotEmpty(userData)) {
|
||||||
|
devVersionVO.setUpdateByName(userData.get(0).getName());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(item.getSoftinfoId())) {
|
||||||
|
CsSoftInfoPO softInfoPO = csSoftInfoService.getById(item.getSoftinfoId());
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotNull(softInfoPO)) {
|
||||||
|
CsEdDataPO csEdDataPO = csEdDataService.findByDevTypeIdAndVersionNo(item.getDevModel(), softInfoPO.getAppVersion());
|
||||||
|
if (ObjectUtil.isNotNull(csEdDataPO)) {
|
||||||
|
devVersionVO.setVersion(csEdDataPO.getVersionNo());
|
||||||
|
devVersionVO.setProtocolVersion(csEdDataPO.getVersionAgreement());
|
||||||
|
devVersionVO.setVersionDate(csEdDataPO.getVersionDate());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
devVersionVO.setStatus(item.getUsageStatus());
|
||||||
|
devVersionVO.setIcd(item.getIcd());
|
||||||
|
if (StrUtil.isNotBlank(item.getDevModel())) {
|
||||||
|
SysDicTreePO sysDicTreePO = dictTreeFeignClient.queryById(item.getDevModel()).getData();
|
||||||
|
if (ObjectUtil.isNotNull(sysDicTreePO)) {
|
||||||
|
devVersionVO.setDevModelName(sysDicTreePO.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isNotBlank(item.getAssociatedEngineering())) {
|
||||||
|
devVersionVO.setAssociatedEngineering(csEngineeringService.getById(item.getAssociatedEngineering()).getName());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(item.getAssociatedProject())) {
|
||||||
|
devVersionVO.setAssociatedProject(appProjectService.getById(item.getAssociatedProject()).getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断装置是否已经连接上mqtt服务器
|
||||||
|
String clientName = "NJCN-" + item.getNdid().substring(item.getNdid().length() - 6);
|
||||||
|
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||||
|
if (mqttClient) {
|
||||||
|
devVersionVO.setConnectStatus(1);
|
||||||
|
} else {
|
||||||
|
devVersionVO.setConnectStatus(0);
|
||||||
|
}
|
||||||
|
finalRecords.add(devVersionVO);
|
||||||
|
});
|
||||||
|
|
||||||
|
Page<DevVersionVO> resultPage = new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam));
|
||||||
|
if (ObjectUtil.isNotNull(baseParam.getConnectStatus())) {
|
||||||
|
records = records.stream().filter(item -> baseParam.getConnectStatus().equals(item.getConnectStatus())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
resultPage.setTotal(CollectionUtil.isEmpty(records) ? 0 : records.size());
|
||||||
|
resultPage.setRecords(records);
|
||||||
|
resultPage.setTotal(page.getTotal());
|
||||||
|
resultPage.setMaxLimit(page.getMaxLimit());
|
||||||
|
resultPage.setPages(page.getPages());
|
||||||
|
|
||||||
|
return resultPage;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsEquipmentDeliveryPO> getRunPortableDev(String userId) {
|
public List<CsEquipmentDeliveryPO> getRunPortableDev(String userId) {
|
||||||
List<CsEquipmentDeliveryPO> result = new ArrayList<>();
|
List<CsEquipmentDeliveryPO> result = new ArrayList<>();
|
||||||
@@ -1116,9 +1173,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
throw new BusinessException("便携式设备类型字典缺失");
|
throw new BusinessException("便携式设备类型字典缺失");
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getDevType,vo.getId())
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getDevType, vo.getId()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).eq(CsEquipmentDeliveryPO::getUsageStatus, 1);
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1);
|
|
||||||
//获取用户已经绑定的便携式设备
|
//获取用户已经绑定的便携式设备
|
||||||
List<String> devList = csDeviceUserPOService.findDevByUserId(userId);
|
List<String> devList = csDeviceUserPOService.findDevByUserId(userId);
|
||||||
if (CollectionUtil.isNotEmpty(devList)) {
|
if (CollectionUtil.isNotEmpty(devList)) {
|
||||||
@@ -1132,12 +1187,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
queryWrapper.in(CsLedger::getId, ids);
|
queryWrapper.in(CsLedger::getId, ids);
|
||||||
List<CsLedger> list = csLedgerService.list(queryWrapper);
|
List<CsLedger> list = csLedgerService.list(queryWrapper);
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
Set<String> idSet = list.stream()
|
Set<String> idSet = list.stream().map(CsLedger::getId).collect(Collectors.toSet());
|
||||||
.map(CsLedger::getId)
|
return result.stream().filter(data -> idSet.contains(data.getId())).collect(Collectors.toList());
|
||||||
.collect(Collectors.toSet());
|
|
||||||
return result.stream()
|
|
||||||
.filter(data -> idSet.contains(data.getId()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
} else {
|
} else {
|
||||||
result.clear();
|
result.clear();
|
||||||
return result;
|
return result;
|
||||||
@@ -1149,26 +1200,22 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
//根据前置机id获取装置数量
|
//根据前置机id获取装置数量
|
||||||
public List<CsEquipmentDeliveryPO> getListByNodeId(String nodeId) {
|
public List<CsEquipmentDeliveryPO> getListByNodeId(String nodeId) {
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId)
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId, nodeId).in(CsEquipmentDeliveryPO::getRunStatus, Arrays.asList(1, 2));
|
||||||
.in(CsEquipmentDeliveryPO::getRunStatus,Arrays.asList(1,2));
|
|
||||||
return this.list(lambdaQueryWrapper);
|
return this.list(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int findLeastFrequentProcess(List<CsEquipmentDeliveryPO> items, Integer process) {
|
public int findLeastFrequentProcess(List<CsEquipmentDeliveryPO> items, Integer process) {
|
||||||
Map<Integer, Long> processCounts = items.stream()
|
Map<Integer, Long> processCounts = items.stream().collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeProcess, Collectors.counting()));
|
||||||
.collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeProcess, Collectors.counting()));
|
|
||||||
for (int i = 1; i <= process; i++) {
|
for (int i = 1; i <= process; i++) {
|
||||||
processCounts.putIfAbsent(i, 0L);
|
processCounts.putIfAbsent(i, 0L);
|
||||||
}
|
}
|
||||||
//如果列表为空,默认返回1
|
//如果列表为空,默认返回1
|
||||||
return processCounts.entrySet().stream()
|
return processCounts.entrySet().stream().min(Comparator.comparingLong(Map.Entry::getValue)).map(Map.Entry::getKey).orElse(1);
|
||||||
.min(Comparator.comparingLong(Map.Entry::getValue))
|
|
||||||
.map(Map.Entry::getKey)
|
|
||||||
.orElse(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ndid生成二维码
|
* 根据ndid生成二维码
|
||||||
|
*
|
||||||
* @param ndid
|
* @param ndid
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csdevice.mapper.CsEventSendMsgMapper;
|
import com.njcn.csdevice.mapper.CsEventSendMsgMapper;
|
||||||
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
|
||||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||||
import com.njcn.csdevice.service.ICsEventSendMsgService;
|
import com.njcn.csdevice.service.ICsEventSendMsgService;
|
||||||
import com.njcn.cssystem.pojo.po.CsFeedbackChatPO;
|
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import com.njcn.user.api.UserFeignClient;
|
import com.njcn.user.api.UserFeignClient;
|
||||||
|
|||||||
@@ -25,12 +25,14 @@ import com.njcn.csdevice.mapper.CsDataSetMapper;
|
|||||||
import com.njcn.csdevice.mapper.CsGroArrMapper;
|
import com.njcn.csdevice.mapper.CsGroArrMapper;
|
||||||
import com.njcn.csdevice.mapper.CsGroupMapper;
|
import com.njcn.csdevice.mapper.CsGroupMapper;
|
||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
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.param.EnergyBaseParam;
|
||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
||||||
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
|
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
|
||||||
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||||
import com.njcn.csdevice.service.ICsGroupService;
|
import com.njcn.csdevice.service.ICsGroupService;
|
||||||
import com.njcn.csdevice.service.ICsLedgerService;
|
import com.njcn.csdevice.service.ICsLedgerService;
|
||||||
@@ -65,11 +67,8 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.temporal.ChronoUnit;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -112,6 +111,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
|
|
||||||
private final String GRID_SIDE_DICT_CODE = "Grid_Side";
|
private final String GRID_SIDE_DICT_CODE = "Grid_Side";
|
||||||
private final String LOAD_SIDE_DICT_CODE = "Load_Side";
|
private final String LOAD_SIDE_DICT_CODE = "Load_Side";
|
||||||
|
private final CsLinePOService csLinePOService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -316,24 +316,28 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||||
}
|
}
|
||||||
Double ct = finalCsLinePOList.get(0).getCtRatio();
|
Double ct = finalCsLinePOList.get(0).getCtRatio() / (Objects.isNull(finalCsLinePOList.get(0).getCt2Ratio())?1.0:finalCsLinePOList.get(0).getCt2Ratio());
|
||||||
Double pt = finalCsLinePOList.get(0).getPtRatio();
|
Double pt = finalCsLinePOList.get(0).getPtRatio() / (Objects.isNull(finalCsLinePOList.get(0).getPt2Ratio())?1.0:finalCsLinePOList.get(0).getPt2Ratio());
|
||||||
if(CollectionUtil.isNotEmpty(commonStatisticalQueryParam.getList())){
|
if(CollectionUtil.isNotEmpty(commonStatisticalQueryParam.getList())){
|
||||||
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
||||||
|
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||||
eleEpdPqds.forEach(epdPqd->{
|
eleEpdPqds.forEach(epdPqd->{
|
||||||
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
||||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
commonQueryParam.setLineId(temp.getLineId());
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
|
if (epdPqd.getName() == null || epdPqd.getName().isEmpty()) {
|
||||||
commonQueryParam.setColumnName(epdPqd.getName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
|
commonQueryParam.setColumnName(epdPqd.getName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
|
||||||
|
} else {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getOtherName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
|
||||||
|
}
|
||||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
|
|
||||||
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(commonStatisticalQueryParam.getStartTime(),DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(commonStatisticalQueryParam.getStartTime(),DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(commonStatisticalQueryParam.getEndTime(),DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(commonStatisticalQueryParam.getEndTime(),DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
|
||||||
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType().toUpperCase());
|
||||||
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||||
return commonQueryParam;
|
return commonQueryParam;
|
||||||
@@ -343,7 +347,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
String unit;
|
String unit;
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("T",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
@@ -451,21 +455,6 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
vo.setAnotherName(epdPqd.getShowName());
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
return vo;
|
return vo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
//长时闪变
|
|
||||||
if (Objects.equals(epdPqd.getOtherName(), "plt")) {
|
|
||||||
List<Instant> timeInstants = getTimeInstants(commonStatisticalQueryParam.getStartTime(), commonStatisticalQueryParam.getEndTime(), 2, ChronoUnit.HOURS, DEFAULT_ZONE);
|
|
||||||
collect1 = collect1.stream()
|
|
||||||
.filter(vo -> timeInstants.contains(vo.getTime()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
//短时闪变 || 电压波动
|
|
||||||
else if (Objects.equals(epdPqd.getOtherName(), "pst") || Objects.equals(epdPqd.getOtherName(), "fluc")) {
|
|
||||||
List<Instant> timeInstants = getTimeInstants(commonStatisticalQueryParam.getStartTime(), commonStatisticalQueryParam.getEndTime(), 10, ChronoUnit.MINUTES, DEFAULT_ZONE);
|
|
||||||
collect1 = collect1.stream()
|
|
||||||
.filter(vo -> timeInstants.contains(vo.getTime()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
result.addAll(collect1);
|
result.addAll(collect1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -493,8 +482,13 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
commonQueryParam.setLineId(temp.getLineId());
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
commonQueryParam.setColumnName(epdPqd.getName()+ finalFrequency);
|
commonQueryParam.setColumnName(epdPqd.getName()+ finalFrequency);
|
||||||
|
if (epdPqd.getName() == null || epdPqd.getName().isEmpty()) {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getName()+ finalFrequency);
|
||||||
|
} else {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getOtherName()+ finalFrequency);
|
||||||
|
}
|
||||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType() == null ? DataParam.portableDevStatisticalMethods:commonStatisticalQueryParam.getValueType());
|
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType() == null ? DataParam.portableDevStatisticalMethods.toUpperCase():commonStatisticalQueryParam.getValueType().toUpperCase());
|
||||||
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||||
return commonQueryParam;
|
return commonQueryParam;
|
||||||
@@ -503,7 +497,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("T",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
@@ -526,9 +520,24 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
csEventUserQueryPage.setLineId(commonStatisticalQueryParam.getLineId());
|
csEventUserQueryPage.setLineId(commonStatisticalQueryParam.getLineId());
|
||||||
csEventUserQueryPage.setStartTime(commonStatisticalQueryParam.getStartTime());
|
csEventUserQueryPage.setStartTime(commonStatisticalQueryParam.getStartTime());
|
||||||
csEventUserQueryPage.setEndTime(commonStatisticalQueryParam.getEndTime());
|
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();
|
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->{
|
csEventVOPage.getRecords().forEach(temp->{
|
||||||
|
//监测点电压等级
|
||||||
|
Double volGrade = map.get(temp.getLineId()).getVolGrade();
|
||||||
|
if (!Objects.isNull(volGrade)) {
|
||||||
|
temp.setLineVoltage(volGrade);
|
||||||
|
}
|
||||||
//事件描述、相别、暂降幅值,需要特殊处理赋值
|
//事件描述、相别、暂降幅值,需要特殊处理赋值
|
||||||
//事件描述
|
//事件描述
|
||||||
CsLedger dataById = iCsLedgerService.findDataById(temp.getLineId());
|
CsLedger dataById = iCsLedgerService.findDataById(temp.getLineId());
|
||||||
@@ -579,22 +588,163 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return csEventVOPage;
|
return csEventVOPage;
|
||||||
|
} else if ("4".equals(type)) {
|
||||||
|
formatQueryParamList(commonStatisticalQueryParam);
|
||||||
|
List<ThdDataVO> result = new ArrayList<>();
|
||||||
|
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Collections.singletonList(commonStatisticalQueryParam.getLineId())).getData();
|
||||||
|
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId, finalCsLinePOList.get(0).getDataSetId()));
|
||||||
|
if (Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())) {
|
||||||
|
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||||
}
|
}
|
||||||
return null;
|
Double ct = finalCsLinePOList.get(0).getCtRatio() / (Objects.isNull(finalCsLinePOList.get(0).getCt2Ratio()) ? 1.0 : finalCsLinePOList.get(0).getCt2Ratio());
|
||||||
|
Double pt = finalCsLinePOList.get(0).getPtRatio() / (Objects.isNull(finalCsLinePOList.get(0).getPt2Ratio()) ? 1.0 : finalCsLinePOList.get(0).getPt2Ratio());
|
||||||
|
if (CollectionUtil.isNotEmpty(commonStatisticalQueryParam.getList())) {
|
||||||
|
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()) {
|
||||||
|
|
||||||
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||||
|
eleEpdPqds.forEach(epdPqd -> {
|
||||||
|
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
||||||
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
|
if (epdPqd.getName() == null || epdPqd.getName().isEmpty()) {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
||||||
|
} else {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getOtherName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
||||||
|
}
|
||||||
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
|
|
||||||
|
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(commonStatisticalQueryParam.getStartTime(), DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(commonStatisticalQueryParam.getEndTime(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
|
||||||
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||||
|
return commonQueryParam;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
List<StatisticalDataDTO> deviceRtData;
|
||||||
|
if (commonStatisticalQueryParam.getDataModel() == 0) {
|
||||||
|
deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||||
|
} else {
|
||||||
|
deviceRtData = commonService.getDianDuData(commonQueryParams);
|
||||||
|
}
|
||||||
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
|
String unit;
|
||||||
|
ThdDataVO vo = new ThdDataVO();
|
||||||
|
vo.setLineId(temp.getLineId());
|
||||||
|
vo.setPhase(Objects.equals("T", temp.getPhaseType()) ? null : temp.getPhaseType());
|
||||||
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
|
vo.setPosition(position);
|
||||||
|
vo.setTime(temp.getTime());
|
||||||
|
vo.setStatMethod(temp.getValueType());
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
|
if (temp.getValue() != null) {
|
||||||
|
double re = 0;
|
||||||
|
if (Objects.equals("Primary", commonStatisticalQueryParam.getDataLevel())) {
|
||||||
|
if (Objects.equals("Primary", csDataSet.getDataLevel())) {
|
||||||
|
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||||
|
re = Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue()));
|
||||||
|
vo.setStatisticalData(re);
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
} else {
|
||||||
|
vo.setStatisticalData(Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue())));
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Objects.nonNull(epdPqd.getPrimaryFormula())) {
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
re = temp.getValue() * pt;
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = temp.getValue() * ct;
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() * pt * ct;
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
} else {
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Instant> getTimeInstants(String startDateStr, String endDateStr, long interval, ChronoUnit unit, ZoneId zone) {
|
|
||||||
List<Instant> instants = new ArrayList<>();
|
|
||||||
LocalDate startDate = LocalDate.parse(startDateStr, DATE_FORMATTER);
|
|
||||||
LocalDate endDate = LocalDate.parse(endDateStr, DATE_FORMATTER);
|
|
||||||
// 转换为指定时区的 ZonedDateTime
|
|
||||||
ZonedDateTime current = startDate.atStartOfDay(zone);
|
|
||||||
ZonedDateTime endDateTime = endDate.atTime(23, 59, 59).atZone(zone);
|
|
||||||
while (!current.isAfter(endDateTime)) {
|
|
||||||
instants.add(current.toInstant());
|
|
||||||
current = current.plus(interval, unit);
|
|
||||||
}
|
}
|
||||||
return instants;
|
} else {
|
||||||
|
if (Objects.equals("Primary", csDataSet.getDataLevel())) {
|
||||||
|
if (Objects.nonNull(epdPqd.getPrimaryFormula())) {
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
re = temp.getValue() / pt;
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = temp.getValue() / ct;
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() / pt / ct;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
} else {
|
||||||
|
re = temp.getValue();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
|
}
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vo.setStatisticalData(null);
|
||||||
|
if (Objects.equals("Primary", commonStatisticalQueryParam.getDataLevel())) {
|
||||||
|
if (Objects.equals("Primary", csDataSet.getDataLevel())) {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
} else {
|
||||||
|
if (Objects.nonNull(epdPqd.getPrimaryFormula())) {
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vo.setUnit(unit);
|
||||||
|
vo.setStatisticalIndex(epdPqd.getId());
|
||||||
|
vo.setStatisticalName(epdPqd.getName());
|
||||||
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
result.addAll(collect1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void formatQueryParamList(CommonStatisticalQueryParam commonStatisticalQueryParam){
|
private void formatQueryParamList(CommonStatisticalQueryParam commonStatisticalQueryParam){
|
||||||
@@ -659,7 +809,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("T",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
@@ -736,7 +886,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData();
|
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData();
|
||||||
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
|
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
|
||||||
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||||
ThdDataTdVO.ThdDataSpectrumVOData thdDataSpectrumVOData = new ThdDataTdVO.ThdDataSpectrumVOData();
|
ThdDataTdVO.ThdDataSpectrumVOData thdDataSpectrumVOData = new ThdDataTdVO.ThdDataSpectrumVOData();
|
||||||
List<ThdDataVO> result = new ArrayList();
|
List<ThdDataVO> result = new ArrayList();
|
||||||
eleEpdPqds.forEach(epdPqd->{
|
eleEpdPqds.forEach(epdPqd->{
|
||||||
@@ -759,7 +909,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("T",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
@@ -838,23 +988,25 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())) {
|
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())) {
|
||||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||||
}
|
}
|
||||||
Double ct = finalCsLinePO.getCtRatio();
|
Double ct = finalCsLinePO.getCtRatio() / (Objects.isNull(finalCsLinePO.getCt2Ratio())?1.0:finalCsLinePO.getCt2Ratio());
|
||||||
Double pt = finalCsLinePO.getPtRatio();
|
Double pt = finalCsLinePO.getPtRatio() / (Objects.isNull(finalCsLinePO.getPt2Ratio())?1.0:finalCsLinePO.getPt2Ratio());
|
||||||
if(CollectionUtil.isNotEmpty(trendDataQueryParam.getList())) {
|
if(CollectionUtil.isNotEmpty(trendDataQueryParam.getList())) {
|
||||||
for (TrendDataQueryParam param : trendDataQueryParam.getList()) {
|
for (TrendDataQueryParam param : trendDataQueryParam.getList()) {
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||||
for (EleEpdPqd epdPqd : eleEpdPqds) {
|
for (EleEpdPqd epdPqd : eleEpdPqds) {
|
||||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
commonQueryParam.setLineId(finalCsLinePO.getLineId());
|
commonQueryParam.setLineId(finalCsLinePO.getLineId());
|
||||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
|
if (epdPqd.getName() == null || epdPqd.getName().isEmpty()) {
|
||||||
commonQueryParam.setColumnName(epdPqd.getName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
|
commonQueryParam.setColumnName(epdPqd.getName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
|
||||||
|
} else {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getOtherName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
|
||||||
|
}
|
||||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
|
|
||||||
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(trendDataQueryParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(trendDataQueryParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(trendDataQueryParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(trendDataQueryParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
commonQueryParam.setDataType(trendDataQueryParam.getValueType().toUpperCase());
|
||||||
commonQueryParam.setDataType(trendDataQueryParam.getValueType());
|
|
||||||
|
|
||||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(finalCsLinePO.getLineId()));
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(finalCsLinePO.getLineId()));
|
||||||
|
|
||||||
List<StatisticalDataDTO> deviceRtData = commonService.getNewDeviceRtDataByTime(Collections.singletonList(commonQueryParam));
|
List<StatisticalDataDTO> deviceRtData = commonService.getNewDeviceRtDataByTime(Collections.singletonList(commonQueryParam));
|
||||||
@@ -862,7 +1014,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
String unit;
|
String unit;
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M", temp.getPhaseType()) ? null : temp.getPhaseType());
|
vo.setPhase(Objects.equals("T", temp.getPhaseType()) ? null : temp.getPhaseType());
|
||||||
String position = finalCsLinePO.getPosition();
|
String position = finalCsLinePO.getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
@@ -970,21 +1122,6 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
vo.setAnotherName(epdPqd.getShowName());
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
return vo;
|
return vo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
//长时闪变
|
|
||||||
if (Objects.equals(epdPqd.getOtherName(), "plt")) {
|
|
||||||
List<Instant> timeInstants = getTimeInstants(trendDataQueryParam.getSearchBeginTime(), trendDataQueryParam.getSearchEndTime(), 2, ChronoUnit.HOURS, DEFAULT_ZONE);
|
|
||||||
collect1 = collect1.stream()
|
|
||||||
.filter(vo -> timeInstants.contains(vo.getTime()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
//短时闪变 || 电压波动
|
|
||||||
else if (Objects.equals(epdPqd.getOtherName(), "pst") || Objects.equals(epdPqd.getOtherName(), "fluc")) {
|
|
||||||
List<Instant> timeInstants = getTimeInstants(trendDataQueryParam.getSearchBeginTime(), trendDataQueryParam.getSearchEndTime(), 10, ChronoUnit.MINUTES, DEFAULT_ZONE);
|
|
||||||
collect1 = collect1.stream()
|
|
||||||
.filter(vo -> timeInstants.contains(vo.getTime()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
result.addAll(collect1);
|
result.addAll(collect1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1000,8 +1137,9 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||||
}
|
}
|
||||||
Double ct = finalCsLinePO.getCtRatio();
|
Double ct = finalCsLinePO.getCtRatio() / (Objects.isNull(finalCsLinePO.getCt2Ratio())?1.0:finalCsLinePO.getCt2Ratio());
|
||||||
Double pt = finalCsLinePO.getPtRatio();
|
Double pt = finalCsLinePO.getPtRatio() / (Objects.isNull(finalCsLinePO.getPt2Ratio())?1.0:finalCsLinePO.getPt2Ratio());
|
||||||
|
|
||||||
// String position = finalCsLinePO.getPosition();
|
// String position = finalCsLinePO.getPosition();
|
||||||
Overlimit overlimit = overLimitWlMapper.selectById(finalCsLinePO.getLineId());
|
Overlimit overlimit = overLimitWlMapper.selectById(finalCsLinePO.getLineId());
|
||||||
if (Objects.isNull(overlimit)) {
|
if (Objects.isNull(overlimit)) {
|
||||||
@@ -1011,13 +1149,13 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
if(CollectionUtil.isNotEmpty(fittingDataQueryParam.getList())) {
|
if(CollectionUtil.isNotEmpty(fittingDataQueryParam.getList())) {
|
||||||
for (FittingDataQueryParam param : fittingDataQueryParam.getList()) {
|
for (FittingDataQueryParam param : fittingDataQueryParam.getList()) {
|
||||||
String dictCode = dictTreeFeignClient.queryById(param.getStatisticalId()).getData().getCode();
|
String dictCode = dictTreeFeignClient.queryById(param.getStatisticalId()).getData().getCode();
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||||
List<ThdDataVO> dataList = new ArrayList<>();
|
List<ThdDataVO> dataList = new ArrayList<>();
|
||||||
for (EleEpdPqd epdPqd : eleEpdPqds) {
|
for (EleEpdPqd epdPqd : eleEpdPqds) {
|
||||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
commonQueryParam.setLineId(finalCsLinePO.getLineId());
|
commonQueryParam.setLineId(finalCsLinePO.getLineId());
|
||||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
commonQueryParam.setColumnName(epdPqd.getName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
commonQueryParam.setColumnName(epdPqd.getOtherName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
||||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
|
|
||||||
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(fittingDataQueryParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
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();
|
String dataType = param.getValueType();
|
||||||
if (StrUtil.isEmpty(dataType)) {
|
if (StrUtil.isEmpty(dataType)) {
|
||||||
// 电能质量指标,取限值计算类型,判断是否越限
|
// 电能质量指标,取限值计算类型,判断是否越限
|
||||||
dataType = epdPqd.getFormula();
|
dataType = epdPqd.getFormula().toUpperCase();
|
||||||
|
} else {
|
||||||
|
dataType = dataType.toUpperCase();
|
||||||
}
|
}
|
||||||
commonQueryParam.setDataType(dataType);
|
commonQueryParam.setDataType(dataType);
|
||||||
|
|
||||||
@@ -1038,7 +1178,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
// vo.setLineName(finalCsLinePO.getName());
|
// vo.setLineName(finalCsLinePO.getName());
|
||||||
vo.setPhase(Objects.equals("M", temp.getPhaseType()) ? null : temp.getPhaseType());
|
vo.setPhase(Objects.equals("T", temp.getPhaseType()) ? null : temp.getPhaseType());
|
||||||
// vo.setPosition(position);
|
// vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
vo.setStatMethod(commonQueryParam.getDataType());
|
vo.setStatMethod(commonQueryParam.getDataType());
|
||||||
@@ -1197,10 +1337,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
result.put("before", new ArrayList<>());
|
result.put("before", new ArrayList<>());
|
||||||
result.put("after", new ArrayList<>());
|
result.put("after", new ArrayList<>());
|
||||||
String sensitiveUserId = param.getSensitiveUserId();
|
String sensitiveUserId = param.getSensitiveUserId();
|
||||||
List<CsLinePO> linePOList = csLineFeignClient.getLineBySensitiveUser(Collections.singletonList(sensitiveUserId)).getData();
|
List<CsLinePO> linePOList = csLineFeignClient.getLinesByDevList(Collections.singletonList(sensitiveUserId)).getData();
|
||||||
if (CollUtil.isEmpty(linePOList)) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
|
DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
|
||||||
DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
|
DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
|
||||||
CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
|
CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
|
||||||
@@ -1208,7 +1345,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
TrendDataQueryParam trendDataQueryParam = new TrendDataQueryParam();
|
TrendDataQueryParam trendDataQueryParam = new TrendDataQueryParam();
|
||||||
trendDataQueryParam.setSearchBeginTime(param.getSearchBeginTime());
|
trendDataQueryParam.setSearchBeginTime(param.getSearchBeginTime());
|
||||||
trendDataQueryParam.setSearchEndTime(param.getSearchEndTime());
|
trendDataQueryParam.setSearchEndTime(param.getSearchEndTime());
|
||||||
trendDataQueryParam.setValueType(param.getValueType());
|
trendDataQueryParam.setValueType(param.getValueType().toUpperCase());
|
||||||
trendDataQueryParam.setDataLevel(param.getDataLevel());
|
trendDataQueryParam.setDataLevel(param.getDataLevel());
|
||||||
List<SensitiveUserTrendDataQueryParam> paramList = param.getList();
|
List<SensitiveUserTrendDataQueryParam> paramList = param.getList();
|
||||||
List<TrendDataQueryParam> indexList = paramList.stream().map(item -> {
|
List<TrendDataQueryParam> indexList = paramList.stream().map(item -> {
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||||
import com.njcn.csdevice.api.CsMarketDataFeignClient;
|
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||||
import com.njcn.csdevice.mapper.*;
|
import com.njcn.csdevice.mapper.*;
|
||||||
@@ -71,7 +70,6 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
private final UserFeignClient userFeignClient;
|
private final UserFeignClient userFeignClient;
|
||||||
private final ICsUserPinsService csUserPinsService;
|
private final ICsUserPinsService csUserPinsService;
|
||||||
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||||
private final CsMarketDataFeignClient csMarketDataFeignClient;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -291,6 +289,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
|
|
||||||
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(portables)) {
|
||||||
String id = IdUtil.simpleUUID();
|
String id = IdUtil.simpleUUID();
|
||||||
CsLedgerVO portable1 = new CsLedgerVO();
|
CsLedgerVO portable1 = new CsLedgerVO();
|
||||||
portable1.setLevel(0);
|
portable1.setLevel(0);
|
||||||
@@ -307,6 +306,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
|
|
||||||
portable1.setChildren(Collections.singletonList(portable2));
|
portable1.setChildren(Collections.singletonList(portable2));
|
||||||
tree.add(portable1);
|
tree.add(portable1);
|
||||||
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
csUserPinsService.channelTree(list, tree, 4);
|
csUserPinsService.channelTree(list, tree, 4);
|
||||||
@@ -703,6 +703,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
|
|
||||||
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(portables)) {
|
||||||
String id = IdUtil.simpleUUID();
|
String id = IdUtil.simpleUUID();
|
||||||
CsLedgerVO portable1 = new CsLedgerVO();
|
CsLedgerVO portable1 = new CsLedgerVO();
|
||||||
portable1.setLevel(0);
|
portable1.setLevel(0);
|
||||||
@@ -721,6 +722,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
portable2List.add(portable2);
|
portable2List.add(portable2);
|
||||||
portable1.setChildren(portable2List);
|
portable1.setChildren(portable2List);
|
||||||
tree.add(portable1);
|
tree.add(portable1);
|
||||||
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
csUserPinsService.channelTree(list, tree, 4);
|
csUserPinsService.channelTree(list, tree, 4);
|
||||||
@@ -843,6 +845,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
device.setEquipmentName(dev.getName());
|
device.setEquipmentName(dev.getName());
|
||||||
device.setEquipmentId(devId);
|
device.setEquipmentId(devId);
|
||||||
device.setDevMac(po.getMac());
|
device.setDevMac(po.getMac());
|
||||||
|
device.setNDid(po.getNdid());
|
||||||
device.setProjectId("/");
|
device.setProjectId("/");
|
||||||
device.setProjectName("/");
|
device.setProjectName("/");
|
||||||
device.setEngineeringid("/");
|
device.setEngineeringid("/");
|
||||||
@@ -851,6 +854,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
device.setEquipmentName(dev.getName());
|
device.setEquipmentName(dev.getName());
|
||||||
device.setEquipmentId(devId);
|
device.setEquipmentId(devId);
|
||||||
device.setDevMac(po.getMac());
|
device.setDevMac(po.getMac());
|
||||||
|
device.setNDid(po.getNdid());
|
||||||
CsLedger project = this.findDataById(dev.getPid());
|
CsLedger project = this.findDataById(dev.getPid());
|
||||||
if (ObjectUtil.isNotNull(project)) {
|
if (ObjectUtil.isNotNull(project)) {
|
||||||
device.setProjectId(project.getId());
|
device.setProjectId(project.getId());
|
||||||
@@ -1053,88 +1057,88 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public List<CsLedgerVO> objTree() {
|
// public List<CsLedgerVO> objTree() {
|
||||||
List<CsLedgerVO> result = new ArrayList<>();
|
// List<CsLedgerVO> result = new ArrayList<>();
|
||||||
String userId = RequestUtil.getUserIndex();
|
// String userId = RequestUtil.getUserIndex();
|
||||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
// UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||||
List<String> devIds;
|
// List<String> devIds;
|
||||||
if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
// if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||||
devIds = csEquipmentDeliveryMapper.selectList(null).stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
// devIds = csEquipmentDeliveryMapper.selectList(null).stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||||
} else {
|
// } else {
|
||||||
LambdaQueryWrapper<CsDeviceUserPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
// LambdaQueryWrapper<CsDeviceUserPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.select(CsDeviceUserPO::getDeviceId)
|
// lambdaQueryWrapper.select(CsDeviceUserPO::getDeviceId)
|
||||||
.and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
// .and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
||||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode());
|
// .eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||||
List<CsDeviceUserPO> devList = csDeviceUserPOMapper.selectList(lambdaQueryWrapper);
|
// List<CsDeviceUserPO> devList = csDeviceUserPOMapper.selectList(lambdaQueryWrapper);
|
||||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
// devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
}
|
// }
|
||||||
if (CollUtil.isEmpty(devIds)) {
|
// if (CollUtil.isEmpty(devIds)) {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().in(CsLinePO::getDeviceId, devIds)
|
// List<CsLinePO> poList = csLinePOService.lambdaQuery().in(CsLinePO::getDeviceId, devIds)
|
||||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).ne(CsLinePO::getMonitorUser,"").isNotNull(CsLinePO::getMonitorUser).list();
|
// .eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).ne(CsLinePO::getMonitorUser,"").isNotNull(CsLinePO::getMonitorUser).list();
|
||||||
if (CollUtil.isEmpty(poList)) {
|
// if (CollUtil.isEmpty(poList)) {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
List<String> objIds = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
// 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<String> lineIds = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||||
|
//
|
||||||
List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(objIds).getData();
|
// List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(objIds).getData();
|
||||||
if (CollUtil.isEmpty(pqSensitiveUserList)) {
|
// if (CollUtil.isEmpty(pqSensitiveUserList)) {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
Map<String,String> objMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
// 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));
|
// 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())));
|
// 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<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<CsLedger> projectList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, projectIds));
|
||||||
|
//
|
||||||
List<CsLedgerVO> realProjectList = new ArrayList<>();
|
// List<CsLedgerVO> realProjectList = new ArrayList<>();
|
||||||
projectList.forEach(pro->{
|
// projectList.forEach(pro->{
|
||||||
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
// CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||||
csLedgerVO.setId(pro.getId());
|
// csLedgerVO.setId(pro.getId());
|
||||||
csLedgerVO.setPid(pro.getPid());
|
// csLedgerVO.setPid(pro.getPid());
|
||||||
csLedgerVO.setLevel(pro.getLevel());
|
// csLedgerVO.setLevel(pro.getLevel());
|
||||||
csLedgerVO.setName(pro.getName());
|
// csLedgerVO.setName(pro.getName());
|
||||||
|
//
|
||||||
List<CsLedgerVO> temObjList = new ArrayList<>();
|
// List<CsLedgerVO> temObjList = new ArrayList<>();
|
||||||
if(lineMap.containsKey(pro.getId())){
|
// if(lineMap.containsKey(pro.getId())){
|
||||||
List<String> ids = lineMap.get(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());
|
// List<String> objTemIds = poList.stream().filter(it->ids.contains(it.getLineId())).map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||||
if(CollUtil.isNotEmpty(objTemIds)){
|
// if(CollUtil.isNotEmpty(objTemIds)){
|
||||||
objTemIds.forEach(it->{
|
// objTemIds.forEach(it->{
|
||||||
CsLedgerVO inner = new CsLedgerVO();
|
// CsLedgerVO inner = new CsLedgerVO();
|
||||||
inner.setName(objMap.getOrDefault(it,"未知异常用户"));
|
// inner.setName(objMap.getOrDefault(it,"未知异常用户"));
|
||||||
inner.setId(it);
|
// inner.setId(it);
|
||||||
inner.setLevel(2);
|
// inner.setLevel(2);
|
||||||
temObjList.add(inner);
|
// temObjList.add(inner);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
csLedgerVO.setChildren(temObjList);
|
// csLedgerVO.setChildren(temObjList);
|
||||||
realProjectList.add(csLedgerVO);
|
// realProjectList.add(csLedgerVO);
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
List<String> gcIds = projectList.stream().map(CsLedger::getPid).collect(Collectors.toList());
|
// 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<CsLedger> gcList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, gcIds));
|
||||||
|
//
|
||||||
List<CsLedgerVO> realGcList = new ArrayList<>();
|
// List<CsLedgerVO> realGcList = new ArrayList<>();
|
||||||
gcList.forEach(gc->{
|
// gcList.forEach(gc->{
|
||||||
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
// CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||||
csLedgerVO.setId(gc.getId());
|
// csLedgerVO.setId(gc.getId());
|
||||||
csLedgerVO.setPid(gc.getPid());
|
// csLedgerVO.setPid(gc.getPid());
|
||||||
csLedgerVO.setLevel(gc.getLevel());
|
// csLedgerVO.setLevel(gc.getLevel());
|
||||||
csLedgerVO.setName(gc.getName());
|
// csLedgerVO.setName(gc.getName());
|
||||||
|
//
|
||||||
List<CsLedgerVO> proList = realProjectList.stream().filter(it->gc.getId().equals(it.getPid())).collect(Collectors.toList());
|
// List<CsLedgerVO> proList = realProjectList.stream().filter(it->gc.getId().equals(it.getPid())).collect(Collectors.toList());
|
||||||
csLedgerVO.setChildren(proList);
|
// csLedgerVO.setChildren(proList);
|
||||||
realGcList.add(csLedgerVO);
|
// realGcList.add(csLedgerVO);
|
||||||
});
|
// });
|
||||||
return realGcList;
|
// return realGcList;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsLedgerVO> getProAndEngineer(List<String> id) {
|
public List<CsLedgerVO> getProAndEngineer(List<String> id) {
|
||||||
@@ -1166,60 +1170,33 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
public CsLedgerVO cldTree() {
|
public CsLedgerVO cldTree() {
|
||||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||||
if (CollectionUtil.isEmpty(allList)) {
|
if (CollectionUtil.isEmpty(allList)) {
|
||||||
CsLedgerVO government = new CsLedgerVO();
|
return buildTreeRootNode(new ArrayList<>());
|
||||||
government.setLevel(-1);
|
|
||||||
government.setName("台账树");
|
|
||||||
government.setPid("0");
|
|
||||||
government.setId(IdUtil.simpleUUID());
|
|
||||||
government.setChildren(new ArrayList<>());
|
|
||||||
return government;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<CsLedgerVO> engineeringList = allList.stream()
|
Map<Integer, List<CsLedgerVO>> levelMap = allList.stream()
|
||||||
.filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode()))
|
|
||||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.groupingBy(CsLedgerVO::getLevel));
|
||||||
|
|
||||||
List<CsLedgerVO> projectList = allList.stream()
|
List<CsLedgerVO> engineeringList = levelMap.getOrDefault(LineBaseEnum.ENGINEERING_LEVEL.getCode(), new ArrayList<>());
|
||||||
.filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode()))
|
List<CsLedgerVO> projectList = levelMap.getOrDefault(LineBaseEnum.PROJECT_LEVEL.getCode(), new ArrayList<>());
|
||||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
List<CsLedgerVO> deviceList = levelMap.getOrDefault(LineBaseEnum.DEVICE_LEVEL.getCode(), new ArrayList<>());
|
||||||
.collect(Collectors.toList());
|
List<CsLedgerVO> lineList = levelMap.getOrDefault(LineBaseEnum.LINE_LEVEL.getCode(), new ArrayList<>());
|
||||||
|
|
||||||
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());
|
|
||||||
|
|
||||||
if (CollectionUtil.isEmpty(deviceList)) {
|
if (CollectionUtil.isEmpty(deviceList)) {
|
||||||
CsLedgerVO government = new CsLedgerVO();
|
Map<String, List<CsLedgerVO>> projectByPidMap = projectList.stream()
|
||||||
government.setLevel(-1);
|
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||||
government.setName("台账树");
|
engineeringList.forEach(eng -> eng.setChildren(projectByPidMap.getOrDefault(eng.getId(), new ArrayList<>())));
|
||||||
government.setPid("0");
|
return buildTreeRootNode(engineeringList);
|
||||||
government.setId(IdUtil.simpleUUID());
|
|
||||||
government.setChildren(engineeringList);
|
|
||||||
return government;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 批量查询设备交付信息
|
||||||
List<String> devIds = deviceList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
List<String> devIds = deviceList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||||
List<CsEquipmentDeliveryPO> devs = csEquipmentDeliveryMapper.selectBatchIds(devIds);
|
List<CsEquipmentDeliveryPO> devs = csEquipmentDeliveryMapper.selectBatchIds(devIds);
|
||||||
Map<String, CsEquipmentDeliveryPO> devsMap = devs.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
|
Map<String, CsEquipmentDeliveryPO> devsMap = devs.stream()
|
||||||
Map<String, String> lineDevMap = lineList.stream().collect(Collectors.toMap(CsLedgerVO::getId, CsLedgerVO::getPid));
|
.collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
|
||||||
|
Set<String> cldDevIds = devs.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toSet());
|
||||||
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));
|
|
||||||
|
|
||||||
|
// 填充设备状态信息
|
||||||
deviceList.forEach(device -> {
|
deviceList.forEach(device -> {
|
||||||
CsEquipmentDeliveryPO dev = devsMap.get(device.getId());
|
CsEquipmentDeliveryPO dev = devsMap.get(device.getId());
|
||||||
if (dev != null) {
|
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 -> {
|
lineList.forEach(line -> {
|
||||||
String devId = lineDevMap.get(line.getId());
|
String devId = lineDevMap.get(line.getId());
|
||||||
if (devId != null) {
|
if (devId != null) {
|
||||||
@@ -1238,39 +1218,48 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
engineeringList.forEach(engineering -> {
|
// 预构建pid映射
|
||||||
List<CsLedgerVO> sortedProjects = projectList.stream()
|
Map<String, List<CsLedgerVO>> projectByEngineeringMap = projectList.stream()
|
||||||
.filter(project -> project.getPid().equals(engineering.getId()))
|
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||||
.peek(project -> {
|
Map<String, List<CsLedgerVO>> deviceByProjectMap = deviceList.stream()
|
||||||
List<CsLedgerVO> projectDevices = projectToDeviceMap.getOrDefault(project.getId(), new ArrayList<>());
|
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||||
if (CollectionUtil.isNotEmpty(projectDevices)) {
|
Map<String, List<CsLedgerVO>> lineByDeviceMap = lineList.stream()
|
||||||
List<CsLedgerVO> sortedDevices = projectDevices.stream()
|
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||||
.filter(device -> cldDevIds.contains(device.getId()))
|
|
||||||
.peek(device -> {
|
// 逐层构建树:设备 -> 监测点
|
||||||
List<CsLedgerVO> sortedLines = deviceToLineMap.getOrDefault(device.getId(), new ArrayList<>())
|
deviceList.forEach(device -> {
|
||||||
.stream()
|
if (cldDevIds.contains(device.getId())) {
|
||||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
device.setChildren(lineByDeviceMap.getOrDefault(device.getId(), new ArrayList<>()));
|
||||||
.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);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
CsLedgerVO government = new CsLedgerVO();
|
// 项目 -> 设备(仅包含有交付记录的设备)
|
||||||
government.setLevel(-1);
|
projectList.forEach(project -> {
|
||||||
government.setName("台账树");
|
List<CsLedgerVO> projectDevices = deviceByProjectMap.getOrDefault(project.getId(), new ArrayList<>());
|
||||||
government.setPid("0");
|
if (CollectionUtil.isNotEmpty(projectDevices)) {
|
||||||
government.setId(IdUtil.simpleUUID());
|
List<CsLedgerVO> validDevices = projectDevices.stream()
|
||||||
government.setChildren(engineeringList);
|
.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
|
@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.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.access.api.CsLineLatestDataFeignClient;
|
import com.njcn.access.api.CsLineLatestDataFeignClient;
|
||||||
|
import com.njcn.access.pojo.po.CsLineLatestData;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
|
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||||
import com.njcn.csdevice.mapper.*;
|
import com.njcn.csdevice.mapper.*;
|
||||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
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.param.CsLineParam;
|
||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
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.CsDevModelService;
|
||||||
import com.njcn.csdevice.service.CsLinePOService;
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
import com.njcn.csdevice.service.ICsDataSetService;
|
import com.njcn.csdevice.service.ICsDataSetService;
|
||||||
|
import com.njcn.csharmonic.api.CsHarmonicPlanFeignClient;
|
||||||
|
import com.njcn.csharmonic.api.CsHarmonicPlanLineFeignClient;
|
||||||
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
||||||
|
import com.njcn.csharmonic.param.CsHarmonicPlanLineParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlan;
|
||||||
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
@@ -64,7 +71,6 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
private final ICsDataSetService csDataSetService;
|
private final ICsDataSetService csDataSetService;
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
||||||
private final CsLineLatestDataFeignClient csLineLatestDataFeignClient;
|
|
||||||
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
@@ -72,6 +78,10 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||||
private final DictTreeFeignClient dictTreeFeignClient;
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
private final CsHarmonicPlanFeignClient csHarmonicPlanFeignClient;
|
||||||
|
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
||||||
|
private final CsLineLatestDataFeignClient csLineLatestDataFeignClient;
|
||||||
|
private final CsCommTerminalFeignClient csCommTerminal;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -158,7 +168,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
po.setClDid(param.getLineNo());
|
po.setClDid(param.getLineNo());
|
||||||
//监测位置
|
//监测位置
|
||||||
//DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData();
|
//DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData();
|
||||||
po.setPosition(param.getPosition());
|
po.setPosition(param.getPosition().isEmpty()?null:param.getPosition());
|
||||||
this.save(po);
|
this.save(po);
|
||||||
|
|
||||||
//2.新增台账树信息
|
//2.新增台账树信息
|
||||||
@@ -171,6 +181,17 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
csLedger.setState(1);
|
csLedger.setState(1);
|
||||||
csLedger.setSort(0);
|
csLedger.setSort(0);
|
||||||
csLedgerMapper.insert(csLedger);
|
csLedgerMapper.insert(csLedger);
|
||||||
|
|
||||||
|
//3.新增稳态事件指标配置
|
||||||
|
csHarmonicPlanLineFeignClient.deleteByLineIds(Collections.singletonList(lineId));
|
||||||
|
List<CsHarmonicPlan> planList = csHarmonicPlanFeignClient.getByName("通用方案").getData();
|
||||||
|
if (CollectionUtil.isNotEmpty(planList)) {
|
||||||
|
CsHarmonicPlan plan = planList.get(0);
|
||||||
|
CsHarmonicPlanLineParam param1 = new CsHarmonicPlanLineParam();
|
||||||
|
param1.setId(plan.getId());
|
||||||
|
param1.setLineIds(Collections.singletonList(lineId));
|
||||||
|
csHarmonicPlanLineFeignClient.savePlanLines(param1);
|
||||||
|
}
|
||||||
return po;
|
return po;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,9 +226,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
.set(CsLinePO::getShortCircuitCapacity,param.getShortCircuitCapacity())
|
.set(CsLinePO::getShortCircuitCapacity,param.getShortCircuitCapacity())
|
||||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||||
.set(CsLinePO::getGovern,param.getGovern())
|
|
||||||
.set(CsLinePO::getPosition,param.getPosition())
|
.set(CsLinePO::getPosition,param.getPosition())
|
||||||
.set(CsLinePO::getMonitorUser,param.getMonitorUser())
|
|
||||||
.set(CsLinePO::getLineLogLevel,param.getLineLogLevel())
|
.set(CsLinePO::getLineLogLevel,param.getLineLogLevel())
|
||||||
.set(CsLinePO::getIsImportant,param.getIsImportant());
|
.set(CsLinePO::getIsImportant,param.getIsImportant());
|
||||||
this.update(lambdaUpdateWrapper);
|
this.update(lambdaUpdateWrapper);
|
||||||
@@ -234,6 +253,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
|
|
||||||
this.removeById(id);
|
this.removeById(id);
|
||||||
csLedgerMapper.deleteById(id);
|
csLedgerMapper.deleteById(id);
|
||||||
|
//删除稳态事件指标配置
|
||||||
|
csHarmonicPlanLineFeignClient.deleteByLineIds(Collections.singletonList(id));
|
||||||
|
|
||||||
//新增台账日志
|
//新增台账日志
|
||||||
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||||
@@ -305,11 +326,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsLinePO> getLineBySensitiveUser(List<String> list) {
|
public List<CsEquipmentDeliveryPO> getDevBySensitiveUser(List<String> list) {
|
||||||
return this.lambdaQuery()
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
.in(CsLinePO::getMonitorUser,list)
|
lambdaQueryWrapper.in(CsEquipmentDeliveryPO::getMonitorUser,list)
|
||||||
.eq(CsLinePO::getStatus, 1)
|
.ne(CsEquipmentDeliveryPO::getRunStatus, DataStateEnum.DELETED.getCode());
|
||||||
.list();
|
return csEquipmentDeliveryMapper.selectList(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -322,10 +343,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
List<CsLinePO> poList = getSimpleLine();
|
List<CsLinePO> poList = getSimpleLine();
|
||||||
// 构建基础查询条件
|
// 构建基础查询条件
|
||||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<CsLinePO>()
|
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<CsLinePO>()
|
||||||
.eq(CsLinePO::getStatus, 1)
|
.eq(CsLinePO::getStatus, 1);
|
||||||
// 关联敏感用户
|
|
||||||
//.isNotNull(CsLinePO::getMonitorUser)
|
|
||||||
.orderByAsc(CsLinePO::getMonitorUser);
|
|
||||||
// 只有当lineList不为空时才添加in条件
|
// 只有当lineList不为空时才添加in条件
|
||||||
if (CollUtil.isNotEmpty(poList)) {
|
if (CollUtil.isNotEmpty(poList)) {
|
||||||
List<String> lineList = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
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)) {
|
if (CollUtil.isEmpty(records)) {
|
||||||
return result;
|
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<PqSensitiveUserLineVO> list = new ArrayList<>();
|
||||||
List<String> sensitiveUserIds = list.stream().map(PqSensitiveUserLineVO::getSensitiveUser).distinct().collect(Collectors.toList());
|
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)) {
|
if (CollUtil.isNotEmpty(pqSensitiveUserList)) {
|
||||||
sensitiveUserNameMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
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;
|
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) {
|
for (CsLinePO record : records) {
|
||||||
sensitiveUserLineVO = new PqSensitiveUserLineVO();
|
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.setLineId(record.getLineId());
|
||||||
sensitiveUserLineVO.setLineName(record.getName());
|
sensitiveUserLineVO.setLineName(record.getName());
|
||||||
// 是否治理
|
// 是否治理
|
||||||
if (ObjectUtil.isNotEmpty(record.getGovern())) {
|
String governMethod = devMap.get(record.getDeviceId()).getGovernMethod();
|
||||||
if (record.getGovern().equals(0)) {
|
sensitiveUserLineVO.setGovern(Objects.isNull(governMethod) ? "未治理" : governMethod);
|
||||||
sensitiveUserLineVO.setGovern("未治理");
|
|
||||||
}
|
|
||||||
if (record.getGovern().equals(1)) {
|
|
||||||
sensitiveUserLineVO.setGovern("已治理");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 监测类型
|
// 监测类型
|
||||||
if (ObjectUtil.isNotNull(record.getPosition())) {
|
if (ObjectUtil.isNotNull(record.getPosition())) {
|
||||||
sensitiveUserLineVO.setPosition(record.getPosition());
|
sensitiveUserLineVO.setPosition(record.getPosition());
|
||||||
@@ -379,22 +409,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
sensitiveUserLineVO.setVolGrade(record.getVolGrade());
|
sensitiveUserLineVO.setVolGrade(record.getVolGrade());
|
||||||
}
|
}
|
||||||
// 运行状态
|
// 运行状态
|
||||||
if (ObjectUtil.isNotNull(record.getRunStatus())) {
|
sensitiveUserLineVO.setRunStatus(String.valueOf(devDetailDTOMap.get(record.getLineId()).getRunStatus()));
|
||||||
//获取设备状态
|
|
||||||
int devRunStatus = csEquipmentDeliveryMapper.selectById(record.getDeviceId()).getRunStatus();
|
|
||||||
sensitiveUserLineVO.setRunStatus(getRunStatusDescription(devRunStatus));
|
|
||||||
}
|
|
||||||
// 报告文件
|
// 报告文件
|
||||||
sensitiveUserLineVO.setReportFilePath(record.getReportFilePath());
|
sensitiveUserLineVO.setReportFilePath(record.getReportFilePath());
|
||||||
//最新数据时间
|
//最新数据时间
|
||||||
// List<CsLineLatestData> lineLatestDataList = csLineLatestDataFeignClient.listData().getData();
|
sensitiveUserLineVO.setLatestTime(Objects.isNull(lineLatestDataMap.get(record.getLineId()))? null : lineLatestDataMap.get(record.getLineId()).getTimeId());
|
||||||
// if (CollUtil.isNotEmpty(lineLatestDataList)) {
|
|
||||||
// sensitiveUserLineVO.setLatestTime(lineLatestDataList.stream()
|
|
||||||
// .filter(item -> item.getLineId().equals(record.getLineId()))
|
|
||||||
// .map(CsLineLatestData::getTimeId)
|
|
||||||
// .max(LocalDateTime::compareTo)
|
|
||||||
// .orElse(null));
|
|
||||||
// }
|
|
||||||
list.add(sensitiveUserLineVO);
|
list.add(sensitiveUserLineVO);
|
||||||
}
|
}
|
||||||
result.setRecords(list);
|
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.setBdName(csLedgerMapper.selectById(csLedger.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).getName());
|
||||||
}
|
}
|
||||||
lineDetailDataVO.setLineName(csLinePO.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.setLineId(csLinePO.getLineId());
|
||||||
lineDetailDataVO.setPtType(PubUtils.ptType(csLinePO.getConType()));
|
lineDetailDataVO.setPtType(PubUtils.ptType(csLinePO.getConType()));
|
||||||
lineDetailDataVO.setPt(csLinePO.getPtRatio() + "/" + (Objects.isNull(csLinePO.getPt2Ratio())?1.0:csLinePO.getPt2Ratio()));
|
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) {
|
public List<CsLinePO> getLineList(CsLinePO param) {
|
||||||
List<String> keywordsLineIds = new ArrayList<>();
|
List<String> keywordsLineIds = new ArrayList<>();
|
||||||
List<CsLinePO> poList = getSimpleLine();
|
List<CsLinePO> poList = getSimpleLine();
|
||||||
if (CollUtil.isNotEmpty(poList)) {
|
if (CollUtil.isNotEmpty(poList) && !poList.isEmpty()) {
|
||||||
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
return poList;
|
||||||
}
|
}
|
||||||
List<CsLinePO> result = this.list(new LambdaQueryWrapper<CsLinePO>()
|
List<CsLinePO> result = this.list(new LambdaQueryWrapper<CsLinePO>()
|
||||||
.eq(CsLinePO::getStatus, 1)
|
.eq(CsLinePO::getStatus, 1)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -163,7 +164,7 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
|||||||
@Override
|
@Override
|
||||||
public List<CsTerminalReply> getBzReplyData(String lineId) {
|
public List<CsTerminalReply> getBzReplyData(String lineId) {
|
||||||
LambdaQueryWrapper<CsTerminalReply> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsTerminalReply> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.in(CsTerminalReply::getCode,Arrays.asList("allFile","allEvent","oneFile"))
|
wrapper.in(CsTerminalReply::getCode,Arrays.asList("allFile","allEvent","oneFile","harmonic"))
|
||||||
.orderByDesc(CsTerminalReply::getCreateTime);
|
.orderByDesc(CsTerminalReply::getCreateTime);
|
||||||
if (!Objects.isNull(lineId) && StringUtils.isNotBlank(lineId)) {
|
if (!Objects.isNull(lineId) && StringUtils.isNotBlank(lineId)) {
|
||||||
wrapper.like(CsTerminalReply::getLineId,lineId);
|
wrapper.like(CsTerminalReply::getLineId,lineId);
|
||||||
@@ -177,30 +178,13 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
|||||||
QueryWrapper<CsTerminalReply> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsTerminalReply> queryWrapper = new QueryWrapper<>();
|
||||||
if (StrUtil.isNotBlank(param.getSearchValue())) {
|
if (StrUtil.isNotBlank(param.getSearchValue())) {
|
||||||
queryWrapper.like("cs_terminal_reply.line_id", param.getSearchValue());
|
queryWrapper.like("cs_terminal_reply.line_id", param.getSearchValue());
|
||||||
// //获取监测点id
|
|
||||||
// List<CsLinePO> list = csLinePOService.getLineByName(param.getSearchValue());
|
|
||||||
// if (CollectionUtil.isEmpty(list)) {
|
|
||||||
// return page;
|
|
||||||
// } else {
|
|
||||||
// queryWrapper.and(pr -> {
|
|
||||||
// // 获取所有 lineId
|
|
||||||
// List<String> lineIds = list.stream()
|
|
||||||
// .map(CsLinePO::getLineId)
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// // 使用 OR 条件连接多个 lineId
|
|
||||||
// for (int i = 0; i < lineIds.size(); i++) {
|
|
||||||
// if (i == 0) {
|
|
||||||
// pr.like("cs_terminal_reply.line_id", lineIds.get(i));
|
|
||||||
// } else {
|
|
||||||
// pr.or().like("cs_terminal_reply.line_id", lineIds.get(i));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
queryWrapper.between("cs_terminal_reply.Create_Time"
|
||||||
|
, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime()))
|
||||||
|
, DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())));
|
||||||
//排序
|
//排序
|
||||||
queryWrapper.orderBy(true, false, "cs_terminal_reply.create_time");
|
queryWrapper.orderBy(true, false, "cs_terminal_reply.create_time");
|
||||||
queryWrapper.in("cs_terminal_reply.code", Arrays.asList("allFile", "allEvent", "oneFile"));
|
queryWrapper.in("cs_terminal_reply.code", Arrays.asList("allFile", "allEvent", "oneFile","harmonic"));
|
||||||
Page<CsTerminalReply> csTerminalReplyPage = this.baseMapper.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
Page<CsTerminalReply> csTerminalReplyPage = this.baseMapper.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
||||||
|
|
||||||
List<CsTerminalReply> records = csTerminalReplyPage.getRecords();
|
List<CsTerminalReply> records = csTerminalReplyPage.getRecords();
|
||||||
@@ -209,6 +193,9 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
|||||||
Map<String, CsLedgerVO> ledgerMap = data.stream().collect(Collectors.toMap(CsLedgerVO::getId, Function.identity()));
|
Map<String, CsLedgerVO> ledgerMap = data.stream().collect(Collectors.toMap(CsLedgerVO::getId, Function.identity()));
|
||||||
List<CldLogsVo> cldLogsVos = new ArrayList<>();
|
List<CldLogsVo> cldLogsVos = new ArrayList<>();
|
||||||
records.forEach(item->{
|
records.forEach(item->{
|
||||||
|
if (Objects.isNull(ledgerMap.get(item.getDeviceId()))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String pids = ledgerMap.get(item.getDeviceId()).getPids();
|
String pids = ledgerMap.get(item.getDeviceId()).getPids();
|
||||||
String[] split = pids.split(",");
|
String[] split = pids.split(",");
|
||||||
CldLogsVo cldLogsVo = new CldLogsVo();
|
CldLogsVo cldLogsVo = new CldLogsVo();
|
||||||
@@ -278,6 +265,9 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
|||||||
case "oneFile":
|
case "oneFile":
|
||||||
result = "补召单事件波形";
|
result = "补召单事件波形";
|
||||||
break;
|
break;
|
||||||
|
case "harmonic":
|
||||||
|
result = "稳态数据";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
result = "未知";
|
result = "未知";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.csdevice.mapper.CsUpgradeLogsMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||||
|
import com.njcn.csdevice.service.CsUpgradeLogsService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-23
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CsUpgradeLogsServiceImpl extends ServiceImpl<CsUpgradeLogsMapper, CsUpgradeLogs> implements CsUpgradeLogsService {
|
||||||
|
}
|
||||||
@@ -37,7 +37,6 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
private final ChannelObjectUtil channelObjectUtil;
|
private final ChannelObjectUtil channelObjectUtil;
|
||||||
private final FileStorageUtil fileStorageUtil;
|
|
||||||
private final MqttUtil mqttUtil;
|
private final MqttUtil mqttUtil;
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
@@ -51,11 +50,14 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
}
|
}
|
||||||
redisUtil.delete(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
redisUtil.delete(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
||||||
askDeviceDataFeignClient.askDeviceRootPath(nDid);
|
askDeviceDataFeignClient.askDeviceRootPath(nDid);
|
||||||
Thread.sleep(3000);
|
for (int i = 0; i <= 3; i++) {
|
||||||
|
Thread.sleep(1000);
|
||||||
Object object = redisUtil.getObjectByKey(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
Object object = redisUtil.getObjectByKey(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
||||||
if (Objects.nonNull(object)) {
|
if (Objects.nonNull(object)) {
|
||||||
makeUpVo.setPrjDataPath(object.toString());
|
makeUpVo.setPrjDataPath(object.toString());
|
||||||
makeUpVo.setType("dir");
|
makeUpVo.setType("dir");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BusinessException(e.getMessage());
|
throw new BusinessException(e.getMessage());
|
||||||
@@ -75,12 +77,15 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
redisUtil.delete(AppRedisKey.PROJECT_INFO + nDid);
|
redisUtil.delete(AppRedisKey.PROJECT_INFO + nDid);
|
||||||
// 请求设备文件或目录信息
|
// 请求设备文件或目录信息
|
||||||
askDeviceDataFeignClient.askDeviceFileOrDir(nDid, name);
|
askDeviceDataFeignClient.askDeviceFileOrDir(nDid, name);
|
||||||
Thread.sleep(10000);
|
for (int i = 0; i <= 10; i++) {
|
||||||
|
Thread.sleep(1000);
|
||||||
// 从 Redis 获取对象
|
// 从 Redis 获取对象
|
||||||
Object object = redisUtil.getObjectByKey(AppRedisKey.PROJECT_INFO + nDid);
|
Object object = redisUtil.getObjectByKey(AppRedisKey.PROJECT_INFO + nDid);
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
// 根据类型处理不同的数据
|
// 根据类型处理不同的数据
|
||||||
processObject(result, object, type);
|
processObject(result, object, type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 捕获特定异常并抛出运行时异常
|
// 捕获特定异常并抛出运行时异常
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
|
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
|
||||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
@@ -18,6 +17,7 @@ import com.njcn.user.api.UserFeignClient;
|
|||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
import com.njcn.user.pojo.po.app.AppInfoSet;
|
import com.njcn.user.pojo.po.app.AppInfoSet;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -25,6 +25,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
class DeviceMessageServiceImpl implements DeviceMessageService {
|
class DeviceMessageServiceImpl implements DeviceMessageService {
|
||||||
|
|
||||||
private final AppUserFeignClient appUserFeignClient;
|
private final AppUserFeignClient appUserFeignClient;
|
||||||
@@ -37,17 +38,17 @@ class DeviceMessageServiceImpl implements DeviceMessageService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getEventUserByDeviceId(String devId, Boolean isAdmin) {
|
public List<String> getEventUserByDeviceId(String devId, Boolean isAdmin) {
|
||||||
List<String> list = csDeviceUserFeignClient.findUserById(devId).getData();
|
|
||||||
List<String> result = new ArrayList<>(list);
|
|
||||||
if (isAdmin) {
|
|
||||||
List<User> adminUser = appUserFeignClient.getAdminInfo().getData();
|
List<User> adminUser = appUserFeignClient.getAdminInfo().getData();
|
||||||
List<String> adminList = adminUser.stream().map(User::getId).collect(Collectors.toList());
|
List<String> adminList = adminUser.stream().map(User::getId).collect(Collectors.toList());
|
||||||
result.addAll(adminList);
|
if (isAdmin) {
|
||||||
|
List<String> list = csDeviceUserFeignClient.findUserById(devId).getData();
|
||||||
|
List<String> result = new ArrayList<>(list);
|
||||||
|
adminList.addAll(result);
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(result)) {
|
if (CollectionUtil.isNotEmpty(adminList)) {
|
||||||
result = result.stream().distinct().collect(Collectors.toList());
|
adminList = adminList.stream().distinct().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
return result;
|
return adminList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -86,14 +87,20 @@ class DeviceMessageServiceImpl implements DeviceMessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getLineInfo(String id) {
|
public void getLineInfo(String id, List<CsLinePO> list) {
|
||||||
Map<Integer,String> map = new HashMap<>();
|
Map<Integer,String> map = new HashMap<>();
|
||||||
List<CsLinePO> lineList = csLinePOService.findByNdid(id);
|
List<CsLinePO> lineList;
|
||||||
|
if (CollectionUtil.isNotEmpty(list) && list != null) {
|
||||||
|
lineList = list;
|
||||||
|
} else {
|
||||||
|
lineList = csLinePOService.findByNdid(id);
|
||||||
|
}
|
||||||
if (CollectionUtil.isEmpty(lineList)){
|
if (CollectionUtil.isEmpty(lineList)){
|
||||||
throw new BusinessException("监测点为空");
|
log.error("监测点为空");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
for (CsLinePO item : lineList) {
|
for (CsLinePO item : lineList) {
|
||||||
if (Objects.isNull(item.getPosition())){
|
if (Objects.isNull(item.getPosition()) || item.getPosition().isEmpty()){
|
||||||
map.put(item.getClDid(),item.getLineId());
|
map.put(item.getClDid(),item.getLineId());
|
||||||
} else {
|
} else {
|
||||||
DictData dictData = dicDataFeignClient.getDicDataById(item.getPosition()).getData();
|
DictData dictData = dicDataFeignClient.getDicDataById(item.getPosition()).getData();
|
||||||
@@ -103,6 +110,8 @@ class DeviceMessageServiceImpl implements DeviceMessageService {
|
|||||||
map.put(1,item.getLineId());
|
map.put(1,item.getLineId());
|
||||||
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
|
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
|
||||||
map.put(2,item.getLineId());
|
map.put(2,item.getLineId());
|
||||||
|
} else {
|
||||||
|
map.put(item.getClDid(),item.getLineId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,9 +164,8 @@ class IcdServiceImpl implements IcdService {
|
|||||||
}
|
}
|
||||||
Integer level = csLedger.getLevel();
|
Integer level = csLedger.getLevel();
|
||||||
String[] pids = csLedger.getPids().split(StrUtil.COMMA);
|
String[] pids = csLedger.getPids().split(StrUtil.COMMA);
|
||||||
Integer sort = csLedger.getSort();
|
|
||||||
// 设置工程信息(所有级别都需要)
|
// 设置工程信息(所有级别都需要)
|
||||||
setEngineeringInfo(vo, level, pids, id, sort);
|
setEngineeringInfo(vo, level, pids, id);
|
||||||
// 根据级别设置不同的业务数据
|
// 根据级别设置不同的业务数据
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -251,13 +250,13 @@ class IcdServiceImpl implements IcdService {
|
|||||||
DatePattern.NORM_DATETIME_PATTERN
|
DatePattern.NORM_DATETIME_PATTERN
|
||||||
);
|
);
|
||||||
if (CollectionUtil.isNotEmpty(param.getLineList())) {
|
if (CollectionUtil.isNotEmpty(param.getLineList())) {
|
||||||
processWithLineIds(param.getLineList(), beginDay, endDay);
|
processWithLineIds(param.getLineList(), beginDay, endDay, param.getBzType());
|
||||||
} else {
|
} else {
|
||||||
processWithoutLineIds(beginDay, endDay);
|
processWithoutLineIds(beginDay, endDay, param.getBzType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processWithLineIds(List<String> lineList, String beginDay, String endDay) {
|
private void processWithLineIds(List<String> lineList, String beginDay, String endDay, Integer bzType) {
|
||||||
List<CsLinePO> csLineList = csLinePOService.listByIds(lineList);
|
List<CsLinePO> csLineList = csLinePOService.listByIds(lineList);
|
||||||
List<String> deviceIdList = csLineList.stream()
|
List<String> deviceIdList = csLineList.stream()
|
||||||
.map(CsLinePO::getDeviceId)
|
.map(CsLinePO::getDeviceId)
|
||||||
@@ -268,10 +267,10 @@ class IcdServiceImpl implements IcdService {
|
|||||||
Map<String, List<CsEquipmentDeliveryPO>> devMap = equipmentList.stream()
|
Map<String, List<CsEquipmentDeliveryPO>> devMap = equipmentList.stream()
|
||||||
.collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeId));
|
.collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeId));
|
||||||
|
|
||||||
handleEventsAndLogs(devMap, csLineList, beginDay, endDay);
|
handleEventsAndLogs(devMap, csLineList, beginDay, endDay, bzType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processWithoutLineIds(String beginDay, String endDay) {
|
private void processWithoutLineIds(String beginDay, String endDay, Integer bzType) {
|
||||||
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryService.getAllOnline();
|
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryService.getAllOnline();
|
||||||
if (CollectionUtil.isEmpty(devList)) return;
|
if (CollectionUtil.isEmpty(devList)) return;
|
||||||
|
|
||||||
@@ -283,14 +282,15 @@ class IcdServiceImpl implements IcdService {
|
|||||||
Map<String, List<CsEquipmentDeliveryPO>> devMap = devList.stream()
|
Map<String, List<CsEquipmentDeliveryPO>> devMap = devList.stream()
|
||||||
.collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeId));
|
.collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeId));
|
||||||
|
|
||||||
handleEventsAndLogs(devMap, csLineList, beginDay, endDay);
|
handleEventsAndLogs(devMap, csLineList, beginDay, endDay, bzType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleEventsAndLogs(
|
private void handleEventsAndLogs(
|
||||||
Map<String, List<CsEquipmentDeliveryPO>> devMap,
|
Map<String, List<CsEquipmentDeliveryPO>> devMap,
|
||||||
List<CsLinePO> csLineList,
|
List<CsLinePO> csLineList,
|
||||||
String beginDay,
|
String beginDay,
|
||||||
String endDay
|
String endDay,
|
||||||
|
Integer bzType
|
||||||
) {
|
) {
|
||||||
devMap.forEach((nodeId, devices) -> {
|
devMap.forEach((nodeId, devices) -> {
|
||||||
List<BZEventMessage.Event> events = new ArrayList<>();
|
List<BZEventMessage.Event> events = new ArrayList<>();
|
||||||
@@ -300,13 +300,13 @@ class IcdServiceImpl implements IcdService {
|
|||||||
for (CsEquipmentDeliveryPO device : devices) {
|
for (CsEquipmentDeliveryPO device : devices) {
|
||||||
String uuid = IdUtil.simpleUUID();
|
String uuid = IdUtil.simpleUUID();
|
||||||
|
|
||||||
BZEventMessage.Event event = buildEvent(uuid, device, csLineList, beginDay, endDay);
|
BZEventMessage.Event event = buildEvent(uuid, device, csLineList, beginDay, endDay, bzType);
|
||||||
events.add(event);
|
events.add(event);
|
||||||
|
|
||||||
CsTerminalLogs log = buildTerminalLog(uuid, device, csLineList);
|
CsTerminalLogs log = buildTerminalLog(uuid, device, csLineList);
|
||||||
logsToSave.add(log);
|
logsToSave.add(log);
|
||||||
|
|
||||||
List<CsTerminalReply> reply = buildTerminalReply(uuid, device, csLineList);
|
List<CsTerminalReply> reply = buildTerminalReply(uuid, device, csLineList, bzType);
|
||||||
repliesToSave.addAll(reply);
|
repliesToSave.addAll(reply);
|
||||||
}
|
}
|
||||||
csTerminalLogsService.saveBatch(logsToSave);
|
csTerminalLogsService.saveBatch(logsToSave);
|
||||||
@@ -316,7 +316,7 @@ class IcdServiceImpl implements IcdService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private BZEventMessage.Event buildEvent(String guid, CsEquipmentDeliveryPO device,
|
private BZEventMessage.Event buildEvent(String guid, CsEquipmentDeliveryPO device,
|
||||||
List<CsLinePO> csLineList, String beginDay, String endDay) {
|
List<CsLinePO> csLineList, String beginDay, String endDay, Integer bzType) {
|
||||||
BZEventMessage.Event event = new BZEventMessage.Event();
|
BZEventMessage.Event event = new BZEventMessage.Event();
|
||||||
event.setGuid(guid);
|
event.setGuid(guid);
|
||||||
event.setTerminalId(device.getId());
|
event.setTerminalId(device.getId());
|
||||||
@@ -327,7 +327,11 @@ class IcdServiceImpl implements IcdService {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
event.setMonitorIdList(monitorIds);
|
event.setMonitorIdList(monitorIds);
|
||||||
|
if (!Objects.isNull(bzType) && bzType == 0) {
|
||||||
|
event.setDataType(0);
|
||||||
|
} else {
|
||||||
event.setDataType(1);
|
event.setDataType(1);
|
||||||
|
}
|
||||||
event.setTimeInterval(Collections.singletonList(beginDay + "~" + endDay));
|
event.setTimeInterval(Collections.singletonList(beginDay + "~" + endDay));
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
@@ -351,7 +355,7 @@ class IcdServiceImpl implements IcdService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<CsTerminalReply> buildTerminalReply(String replyId, CsEquipmentDeliveryPO device,
|
private List<CsTerminalReply> buildTerminalReply(String replyId, CsEquipmentDeliveryPO device,
|
||||||
List<CsLinePO> csLineList) {
|
List<CsLinePO> csLineList, Integer bzType) {
|
||||||
List<CsTerminalReply> replies = new ArrayList<>();
|
List<CsTerminalReply> replies = new ArrayList<>();
|
||||||
List<String> lineIds = csLineList.stream()
|
List<String> lineIds = csLineList.stream()
|
||||||
.filter(line -> Objects.equals(line.getDeviceId(), device.getId()))
|
.filter(line -> Objects.equals(line.getDeviceId(), device.getId()))
|
||||||
@@ -366,7 +370,11 @@ class IcdServiceImpl implements IcdService {
|
|||||||
reply.setDeviceId(device.getId());
|
reply.setDeviceId(device.getId());
|
||||||
reply.setLineId(lineId);
|
reply.setLineId(lineId);
|
||||||
reply.setIsReceived(0);
|
reply.setIsReceived(0);
|
||||||
|
if (!Objects.isNull(bzType) && bzType == 0) {
|
||||||
|
reply.setCode("harmonic");
|
||||||
|
} else {
|
||||||
reply.setCode("allEvent");
|
reply.setCode("allEvent");
|
||||||
|
}
|
||||||
replies.add(reply);
|
replies.add(reply);
|
||||||
});
|
});
|
||||||
return replies;
|
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;
|
String engineeringId;
|
||||||
|
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
@@ -504,7 +512,7 @@ class IcdServiceImpl implements IcdService {
|
|||||||
vo.setProvince(po.getProvince());
|
vo.setProvince(po.getProvince());
|
||||||
vo.setCity(po.getCity());
|
vo.setCity(po.getCity());
|
||||||
vo.setEngineeringDescription(po.getDescription());
|
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.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,6 +66,27 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqsCommunicateDto> getRawDataOne(LineCountEvaluateParam lineParam) {
|
||||||
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||||
|
influxQueryWrapper.regular(PqsCommunicate::getDevId, lineParam.getLineId())
|
||||||
|
.select(PqsCommunicate::getTime)
|
||||||
|
.select(PqsCommunicate::getDevId)
|
||||||
|
.select(PqsCommunicate::getDescription)
|
||||||
|
.select(PqsCommunicate::getType)
|
||||||
|
.timeAsc()
|
||||||
|
.limit(1);
|
||||||
|
List<PqsCommunicate> list = pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||||
|
list.forEach(item -> {
|
||||||
|
PqsCommunicateDto dto = new PqsCommunicateDto();
|
||||||
|
BeanUtils.copyProperties(item, dto);
|
||||||
|
dto.setTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
||||||
|
result.add(dto);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 获取时间段内的数据
|
* @Description: 获取时间段内的数据
|
||||||
* @Param:
|
* @Param:
|
||||||
@@ -88,6 +108,18 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqsCommunicateDto> getRawData2(LineCountEvaluateParam lineParam) {
|
||||||
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
|
List<PqsCommunicate> list = getPqsCommunicateData(lineParam);
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
list.forEach(item -> {
|
||||||
|
result.add(convertToDto(item));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理有数据的情况
|
* 处理有数据的情况
|
||||||
*/
|
*/
|
||||||
@@ -95,6 +127,20 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
|||||||
List<PqsCommunicateDto> result = new ArrayList<>();
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
int lastIndex = list.size() - 1;
|
int lastIndex = list.size() - 1;
|
||||||
|
|
||||||
|
// 获取第一条数据,补充0点数据(状态与第一条相反)
|
||||||
|
PqsCommunicate firstItem = list.get(0);
|
||||||
|
PqsCommunicateDto firstData = new PqsCommunicateDto();
|
||||||
|
firstData.setTime(lineParam.getStartTime() + " 00:00:00");
|
||||||
|
firstData.setDevId(lineParam.getLineId().get(0));
|
||||||
|
if (Objects.equals(firstItem.getType(), 0)) {
|
||||||
|
firstData.setType(1);
|
||||||
|
firstData.setDescription("通讯正常");
|
||||||
|
} else {
|
||||||
|
firstData.setType(0);
|
||||||
|
firstData.setDescription("通讯中断");
|
||||||
|
}
|
||||||
|
result.add(firstData);
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
PqsCommunicate item = list.get(i);
|
PqsCommunicate item = list.get(i);
|
||||||
PqsCommunicateDto dto = convertToDto(item);
|
PqsCommunicateDto dto = convertToDto(item);
|
||||||
@@ -106,10 +152,10 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
|||||||
result.add(endData);
|
result.add(endData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理无数据的情况
|
* 处理无数据的情况
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,27 +2,27 @@ package com.njcn.csdevice.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||||
|
import com.njcn.advance.api.EventCauseFeignClient;
|
||||||
|
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
|
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
|
||||||
|
import com.njcn.csdevice.param.UploadDataParam;
|
||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
||||||
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
||||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||||
import com.njcn.csdevice.service.CsLinePOService;
|
import com.njcn.csdevice.service.*;
|
||||||
import com.njcn.csdevice.service.IPortableOfflLogService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.njcn.csdevice.param.UploadDataParam;
|
|
||||||
import com.njcn.csdevice.service.IWlRecordService;
|
|
||||||
import com.njcn.csdevice.service.PortableOffMainLogService;
|
|
||||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||||
import com.njcn.csharmonic.api.EventFeignClient;
|
import com.njcn.csharmonic.api.EventFeignClient;
|
||||||
import com.njcn.csharmonic.api.OfflineDataUploadFeignClient;
|
import com.njcn.csharmonic.api.OfflineDataUploadFeignClient;
|
||||||
@@ -36,13 +36,17 @@ import com.njcn.csharmonic.offline.mincfg.AnalyseComtradeCfg;
|
|||||||
import com.njcn.csharmonic.offline.mincfg.vo.CmnModeCfg;
|
import com.njcn.csharmonic.offline.mincfg.vo.CmnModeCfg;
|
||||||
import com.njcn.csharmonic.offline.vo.Response;
|
import com.njcn.csharmonic.offline.vo.Response;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.influx.imapper.EvtDataMapper;
|
import com.njcn.event.common.mapper.WlRmpEventDetailMapper;
|
||||||
import com.njcn.influx.imapper.PqdDataMapper;
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
|
import com.njcn.influx.imapper.*;
|
||||||
|
import com.njcn.influx.pojo.po.*;
|
||||||
import com.njcn.influx.pojo.po.cs.EntData;
|
import com.njcn.influx.pojo.po.cs.EntData;
|
||||||
import com.njcn.influx.pojo.po.cs.PqdData;
|
import com.njcn.influx.pojo.po.cs.PqdData;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.EleEvtFeignClient;
|
import com.njcn.system.api.EleEvtFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
import com.njcn.system.pojo.po.DictData;
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -50,11 +54,10 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
@@ -81,29 +84,37 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
|
|
||||||
|
|
||||||
private final DecimalFormat df = new DecimalFormat("#0.000");
|
private final DecimalFormat df = new DecimalFormat("#0.000");
|
||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
private final OfflineDataUploadFeignClient offlineDataUploadFeignClient;
|
private final OfflineDataUploadFeignClient offlineDataUploadFeignClient;
|
||||||
|
|
||||||
private final EleEvtFeignClient eleEvtFeignClient;
|
private final EleEvtFeignClient eleEvtFeignClient;
|
||||||
|
|
||||||
private final EventFeignClient eventFeignClient;
|
private final EventFeignClient eventFeignClient;
|
||||||
|
|
||||||
private final EquipmentFeignClient equipmentFeignClient;
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
private final InfluxDbParamUtil influxDbParamUtil;
|
private final InfluxDbParamUtil influxDbParamUtil;
|
||||||
|
|
||||||
private final PqdDataMapper pqdDataMapper;
|
private final PqdDataMapper pqdDataMapper;
|
||||||
|
|
||||||
private final EvtDataMapper evtDataMapper;
|
private final EvtDataMapper evtDataMapper;
|
||||||
|
|
||||||
|
private final DataVMapper dataVMapper;
|
||||||
|
private final DataIMapper dataIMapper;
|
||||||
|
private final DataHarmRateVMapper dataHarmRateV;
|
||||||
|
private final DataHarmRateIMapper dataHarmRateI;
|
||||||
|
private final DataInHarmVMapper dataInHarmV;
|
||||||
|
private final DataHarmPowerPMapper dataHarmPowerP;
|
||||||
|
private final DataHarmPowerQMapper dataHarmPowerQ;
|
||||||
|
private final DataHarmPowerSMapper dataHarmPowerS;
|
||||||
|
private final DataFlickerMapper dataFlicker;
|
||||||
|
private final DataFlucMapper dataFluc;
|
||||||
|
private final DataPltMapper dataPlt;
|
||||||
|
private final DataHarmPhasicVMapper dataHarmPhasicV;
|
||||||
|
private final DataHarmPhasicIMapper dataHarmPhasicI;
|
||||||
|
|
||||||
|
private final IPqdDataSplitService pqdDataSplitService;
|
||||||
private final MqttPublisher publisher;
|
private final MqttPublisher publisher;
|
||||||
private final PortableOffMainLogService portableOffMainLogService;
|
private final PortableOffMainLogService portableOffMainLogService;
|
||||||
private final IWlRecordService wlRecordService;
|
private final IWlRecordService wlRecordService;
|
||||||
private final CsLinePOService csLinePOService;
|
private final CsLinePOService csLinePOService;
|
||||||
|
private final WlRmpEventDetailMapper wlRmpEventDetailMapper;
|
||||||
|
private final EventCauseFeignClient eventCauseFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
||||||
@@ -177,7 +188,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@DSTransactional
|
||||||
public void importEquipment(UploadDataParam uploadDataParam){
|
public void importEquipment(UploadDataParam uploadDataParam){
|
||||||
String lineId = uploadDataParam.getLineId();
|
String lineId = uploadDataParam.getLineId();
|
||||||
//获取监测点信息
|
//获取监测点信息
|
||||||
@@ -337,7 +348,6 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
.eq(WlRecord::getEndTime,wlRecord.getEndTime()).update();
|
.eq(WlRecord::getEndTime,wlRecord.getEndTime()).update();
|
||||||
wlRecordService.save(wlRecord);
|
wlRecordService.save(wlRecord);
|
||||||
|
|
||||||
|
|
||||||
//如果明确返回了state 那么当前文件解析出错
|
//如果明确返回了state 那么当前文件解析出错
|
||||||
if(response.getState() != null){
|
if(response.getState() != null){
|
||||||
portableOfflLog.setState(response.getState());
|
portableOfflLog.setState(response.getState());
|
||||||
@@ -353,7 +363,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
List<List<PqdData>> partition = ListUtils.partition(pqdData, 1500);
|
List<List<PqdData>> partition = ListUtils.partition(pqdData, 1500);
|
||||||
for (List<PqdData> sliceList : partition) {
|
for (List<PqdData> sliceList : partition) {
|
||||||
List<PqdData> sublistAsOriginalListType = new ArrayList<>(sliceList);
|
List<PqdData> sublistAsOriginalListType = new ArrayList<>(sliceList);
|
||||||
pqdDataMapper.insertBatch(sublistAsOriginalListType);
|
Map<String, Object> map = pqdDataSplitService.splitPqdData(sublistAsOriginalListType);
|
||||||
|
insertData(map);
|
||||||
}
|
}
|
||||||
//min结果集解析入库后就不需要在解析了
|
//min结果集解析入库后就不需要在解析了
|
||||||
minFlag = false;
|
minFlag = false;
|
||||||
@@ -381,6 +392,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
}
|
}
|
||||||
List<NewTaglogbuffer> newTaglogbuffers = (List<NewTaglogbuffer>) response.getObj();
|
List<NewTaglogbuffer> newTaglogbuffers = (List<NewTaglogbuffer>) response.getObj();
|
||||||
if(newTaglogbuffers != null && !newTaglogbuffers.isEmpty()){
|
if(newTaglogbuffers != null && !newTaglogbuffers.isEmpty()){
|
||||||
|
List<DictData> list1 = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_REASON.getCode()).getData();
|
||||||
|
List<DictData> list2 = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_TYPE.getCode()).getData();
|
||||||
//否则正常标记为成功解析
|
//否则正常标记为成功解析
|
||||||
portableOfflLog.setState(1);
|
portableOfflLog.setState(1);
|
||||||
portableOfflLog.setAllCount(newTaglogbuffers.size());
|
portableOfflLog.setAllCount(newTaglogbuffers.size());
|
||||||
@@ -451,14 +464,32 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
csEventPO.setWavePath(wavePath);
|
csEventPO.setWavePath(wavePath);
|
||||||
|
if (Objects.equals(csEventPO.getTag(),DataParam.dipStrName)) {
|
||||||
|
EventAnalysisDTO var1 = new EventAnalysisDTO();
|
||||||
|
var1.setWlFilePath(wavePath);
|
||||||
|
EventAnalysisDTO dto = eventCauseFeignClient.analysisCauseAndType(var1).getData();
|
||||||
|
String id1 = list1.stream()
|
||||||
|
.filter(item -> Objects.equals(item.getAlgoDescribe(), dto.getCause()))
|
||||||
|
.map(DictData::getId)
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
csEventPO.setAdvanceReason(id1);
|
||||||
|
|
||||||
|
String id2 = list2.stream()
|
||||||
|
.filter(item -> Objects.equals(item.getAlgoDescribe(), dto.getType()))
|
||||||
|
.map(DictData::getId)
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
csEventPO.setAdvanceType(id2);
|
||||||
|
}
|
||||||
|
|
||||||
//默认暂态事件
|
//默认暂态事件
|
||||||
csEventPO.setType(0);
|
csEventPO.setType(0);
|
||||||
String clDid = influxDbParamUtil.getClDidByLineId(uploadDataParam.getLineId());
|
String clDid = influxDbParamUtil.getClDidByLineId(uploadDataParam.getLineId());
|
||||||
csEventPO.setClDid(clDid == null ? null : Integer.parseInt(clDid));
|
csEventPO.setClDid(clDid == null ? null : Integer.parseInt(clDid));
|
||||||
|
|
||||||
|
|
||||||
csEventPO.setProcess(csEquipmentDeliveryDTO.getProcess());
|
csEventPO.setProcess(csEquipmentDeliveryDTO.getProcess());
|
||||||
csEventPOS.add(csEventPO);
|
|
||||||
|
|
||||||
EntData entData = new EntData();
|
EntData entData = new EntData();
|
||||||
entData.setUuid(csEventPO.getId());
|
entData.setUuid(csEventPO.getId());
|
||||||
entData.setTime(new Date().toInstant());
|
entData.setTime(new Date().toInstant());
|
||||||
@@ -503,12 +534,19 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
log.info("类型log,插入infulxDb的evtData");
|
log.info("类型log,插入infulxDb的evtData");
|
||||||
try {
|
try {
|
||||||
evtDataMapper.insertOne(entData);
|
evtDataMapper.insertOne(entData);
|
||||||
|
//添加其余数据
|
||||||
|
csEventPO.setPhase(entData.getEvtParamPhase());
|
||||||
|
csEventPO.setPersistTime(entData.getEvtParamTm());
|
||||||
|
csEventPO.setAmplitude(entData.getEvtParamVVaDepth());
|
||||||
|
csEventPOS.add(csEventPO);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("类型log,插入mysql事件表cs_event");
|
log.info("类型log,插入mysql事件表cs_event");
|
||||||
eventFeignClient.saveBatchEventList(csEventPOS);
|
eventFeignClient.saveBatchEventList(csEventPOS);
|
||||||
|
//同步数据到 r_mp_event_detail
|
||||||
|
csEventPOS.forEach(this::insertEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -529,6 +567,62 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
portableOffMainLogService.save(portableOffMainLog);
|
portableOffMainLogService.save(portableOffMainLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertEvent(CsEventPO item) {
|
||||||
|
RmpEventDetailPO rmpEventDetailPo = new RmpEventDetailPO();
|
||||||
|
rmpEventDetailPo.setEventId(item.getId());
|
||||||
|
rmpEventDetailPo.setMeasurementPointId(item.getLineId());
|
||||||
|
rmpEventDetailPo.setStartTime(item.getStartTime());
|
||||||
|
rmpEventDetailPo.setEventType(getEventType(item.getTag()));
|
||||||
|
rmpEventDetailPo.setFeatureAmplitude(item.getAmplitude());
|
||||||
|
rmpEventDetailPo.setDuration(item.getPersistTime());
|
||||||
|
rmpEventDetailPo.setEventDescribe(getTag(item.getTag()));
|
||||||
|
rmpEventDetailPo.setDealFlag(0);
|
||||||
|
rmpEventDetailPo.setFileFlag(0);
|
||||||
|
rmpEventDetailPo.setPhase(item.getPhase());
|
||||||
|
rmpEventDetailPo.setAdvanceReason(item.getAdvanceReason());
|
||||||
|
rmpEventDetailPo.setAdvanceType(item.getAdvanceType());
|
||||||
|
wlRmpEventDetailMapper.insert(rmpEventDetailPo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTag(String tag) {
|
||||||
|
switch (tag) {
|
||||||
|
case "Evt_Sys_DipStr":
|
||||||
|
tag = DicDataEnum.VOLTAGE_DIP.getCode();
|
||||||
|
break;
|
||||||
|
case "Evt_Sys_SwlStr":
|
||||||
|
tag = DicDataEnum.VOLTAGE_RISE.getCode();
|
||||||
|
break;
|
||||||
|
case "Evt_Sys_IntrStr":
|
||||||
|
tag = DicDataEnum.SHORT_INTERRUPTIONS.getCode();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tag = "Un_Know";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEventType(String tag) {
|
||||||
|
switch (tag) {
|
||||||
|
case "Evt_Sys_DipStr":
|
||||||
|
DictData dip = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
|
||||||
|
tag = dip.getId();
|
||||||
|
break;
|
||||||
|
case "Evt_Sys_SwlStr":
|
||||||
|
DictData rise = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_RISE.getCode()).getData();
|
||||||
|
tag = rise.getId();
|
||||||
|
break;
|
||||||
|
case "Evt_Sys_IntrStr":
|
||||||
|
DictData interruptions = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData();
|
||||||
|
tag = interruptions.getId();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tag = "Un_Know";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PortableOffMainLog> queryMainLogPage(BaseParam baseParam) {
|
public Page<PortableOffMainLog> queryMainLogPage(BaseParam baseParam) {
|
||||||
Page<PortableOffMainLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
|
Page<PortableOffMainLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
|
||||||
@@ -587,7 +681,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
String dictDataCode = null;
|
String dictDataCode = null;
|
||||||
switch (volConType) {
|
switch (volConType) {
|
||||||
case 0:
|
case 0:
|
||||||
dictDataCode = "star";
|
dictDataCode = "Trans_Business";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
dictDataCode = "Star_Triangle";
|
dictDataCode = "Star_Triangle";
|
||||||
@@ -604,4 +698,87 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
}
|
}
|
||||||
return Objects.isNull(result)?null:result;
|
return Objects.isNull(result)?null:result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertData(Map<String, Object> map) {
|
||||||
|
//13张表
|
||||||
|
map.forEach((key, value) -> {
|
||||||
|
switch (key) {
|
||||||
|
case "data_v":
|
||||||
|
dataVMapper.insertBatch((List<DataV>) value);
|
||||||
|
break;
|
||||||
|
case "data_i":
|
||||||
|
dataIMapper.insertBatch((List<DataI>) value);
|
||||||
|
break;
|
||||||
|
case "data_flicker":
|
||||||
|
//10分钟入一组
|
||||||
|
List<DataFlicker> list = (List<DataFlicker>) value;
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
list.forEach(item->{
|
||||||
|
Instant time = getTime(item.getTime(),600);
|
||||||
|
item.setTime(time);
|
||||||
|
});
|
||||||
|
dataFlicker.insertBatch(list);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "data_fluc":
|
||||||
|
//10分钟入一组
|
||||||
|
List<DataFluc> list2 = (List<DataFluc>) value;
|
||||||
|
if (!CollectionUtils.isEmpty(list2)) {
|
||||||
|
list2.forEach(item->{
|
||||||
|
Instant time = getTime(item.getTime(),600);
|
||||||
|
item.setTime(time);
|
||||||
|
});
|
||||||
|
dataFluc.insertBatch(list2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "data_harmphasic_i":
|
||||||
|
dataHarmPhasicI.insertBatch((List<DataHarmPhasicI>) value);
|
||||||
|
break;
|
||||||
|
case "data_harmphasic_v":
|
||||||
|
dataHarmPhasicV.insertBatch((List<DataHarmPhasicV>) value);
|
||||||
|
break;
|
||||||
|
case "data_harmpower_p":
|
||||||
|
dataHarmPowerP.insertBatch((List<DataHarmPowerP>) value);
|
||||||
|
break;
|
||||||
|
case "data_harmpower_q":
|
||||||
|
dataHarmPowerQ.insertBatch((List<DataHarmPowerQ>) value);
|
||||||
|
break;
|
||||||
|
case "data_harmpower_s":
|
||||||
|
dataHarmPowerS.insertBatch((List<DataHarmPowerS>) value);
|
||||||
|
break;
|
||||||
|
case "data_harmrate_v":
|
||||||
|
dataHarmRateV.insertBatch((List<DataHarmRateV>) value);
|
||||||
|
break;
|
||||||
|
case "data_harmrate_i":
|
||||||
|
dataHarmRateI.insertBatch((List<DataHarmRateI>) value);
|
||||||
|
break;
|
||||||
|
case "data_inharm_v":
|
||||||
|
dataInHarmV.insertBatch((List<DataInHarmV>) value);
|
||||||
|
break;
|
||||||
|
case "data_plt":
|
||||||
|
//2小时入一组
|
||||||
|
List<DataPlt> list3 = (List<DataPlt>) value;
|
||||||
|
if (!CollectionUtils.isEmpty(list3)) {
|
||||||
|
list3.forEach(item->{
|
||||||
|
Instant time = getTime(item.getTime(),7200);
|
||||||
|
item.setTime(time);
|
||||||
|
});
|
||||||
|
dataPlt.insertBatch(list3);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "pqd_data":
|
||||||
|
pqdDataMapper.insertBatch((List<PqdData>) value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
log.warn("不支持的目标表: {}", key);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getTime(Instant time, Integer interval) {
|
||||||
|
long originalTimeSec = time.getEpochSecond();
|
||||||
|
long newTimeSec = (originalTimeSec / interval) * interval;
|
||||||
|
return Instant.ofEpochSecond(newTimeSec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,470 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
|
import com.njcn.csdevice.service.IPqdDataSplitService;
|
||||||
|
import com.njcn.influx.pojo.po.*;
|
||||||
|
import com.njcn.influx.pojo.po.cs.PqdData;
|
||||||
|
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||||
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
|
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PqdData数据拆分服务实现
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
* @since 2026-05-22
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PqdDataSplitServiceImpl implements IPqdDataSplitService {
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
|
private final EpdFeignClient epdFeignClient;
|
||||||
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> splitPqdData(List<PqdData> pqdDataList) {
|
||||||
|
//获取表映射关系
|
||||||
|
Map<String,String> map1 = new Gson().fromJson(String.valueOf(redisUtil.getObjectByKey(AppRedisKey.ELE_EPD_PQD)), Map.class);
|
||||||
|
//获取字段映射关系
|
||||||
|
DictData pqd = dicDataFeignClient.getDicDataByCode(DicDataEnum.PQD.getCode()).getData();
|
||||||
|
List<EleEpdPqdListVO> list = epdFeignClient.selectAll().getData();
|
||||||
|
List<EleEpdPqd> epdList = list.stream().filter(item -> Objects.equals(item.getDataType(), pqd.getId()))
|
||||||
|
.findFirst()
|
||||||
|
.map(EleEpdPqdListVO::getEleEpdPqdVOS)
|
||||||
|
.orElse(new ArrayList<>());
|
||||||
|
// 处理 harmStart 和 harmEnd
|
||||||
|
List<EleEpdPqd> resultList = epdList.stream()
|
||||||
|
.flatMap(item -> {
|
||||||
|
if (item.getHarmStart() != null && item.getHarmEnd() != null) {
|
||||||
|
List<EleEpdPqd> expandedList = new ArrayList<>();
|
||||||
|
for (int i = item.getHarmStart(); i <= item.getHarmEnd(); i++) {
|
||||||
|
EleEpdPqd newItem = copyEleEpdPqd(item);
|
||||||
|
newItem.setName(item.getName() + "_" + i);
|
||||||
|
newItem.setOtherName(item.getOtherName() + "_" + i);
|
||||||
|
expandedList.add(newItem);
|
||||||
|
}
|
||||||
|
return expandedList.stream();
|
||||||
|
} else {
|
||||||
|
return Stream.of(item);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
Map<String,List<EleEpdPqd>> map2 = resultList.stream().collect(Collectors.groupingBy(EleEpdPqd::getName,LinkedHashMap::new,Collectors.toList()));
|
||||||
|
Map<String,Object> map3 = new HashMap<>();
|
||||||
|
List<Object> list1 = new ArrayList<>();
|
||||||
|
List<Object> list2 = new ArrayList<>();
|
||||||
|
List<Object> list3 = new ArrayList<>();
|
||||||
|
List<Object> list4 = new ArrayList<>();
|
||||||
|
List<Object> list5 = new ArrayList<>();
|
||||||
|
List<Object> list6 = new ArrayList<>();
|
||||||
|
List<Object> list7 = new ArrayList<>();
|
||||||
|
List<Object> list8 = new ArrayList<>();
|
||||||
|
List<Object> list9 = new ArrayList<>();
|
||||||
|
List<Object> list10 = new ArrayList<>();
|
||||||
|
List<Object> list11 = new ArrayList<>();
|
||||||
|
List<Object> list12 = new ArrayList<>();
|
||||||
|
List<Object> list13 = new ArrayList<>();
|
||||||
|
List<Object> list14 = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (PqdData item : pqdDataList) {
|
||||||
|
Map<String, Object> map = extractFieldValues(item);
|
||||||
|
|
||||||
|
DataV dataV = new DataV();
|
||||||
|
dataV.setTime(item.getTime());
|
||||||
|
dataV.setLineId(item.getLineId());
|
||||||
|
dataV.setPhaseType(item.getPhaseType());
|
||||||
|
dataV.setValueType(item.getValueType());
|
||||||
|
dataV.setClDid(item.getClDid());
|
||||||
|
dataV.setProcess(item.getProcess());
|
||||||
|
dataV.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataI dataI = new DataI();
|
||||||
|
dataI.setTime(item.getTime());
|
||||||
|
dataI.setLineId(item.getLineId());
|
||||||
|
dataI.setPhaseType(item.getPhaseType());
|
||||||
|
dataI.setValueType(item.getValueType());
|
||||||
|
dataI.setClDid(item.getClDid());
|
||||||
|
dataI.setProcess(item.getProcess());
|
||||||
|
dataI.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataFlicker dataFlicker = new DataFlicker();
|
||||||
|
dataFlicker.setTime(item.getTime());
|
||||||
|
dataFlicker.setLineId(item.getLineId());
|
||||||
|
dataFlicker.setPhaseType(item.getPhaseType());
|
||||||
|
dataFlicker.setValueType(item.getValueType());
|
||||||
|
dataFlicker.setClDid(item.getClDid());
|
||||||
|
dataFlicker.setProcess(item.getProcess());
|
||||||
|
dataFlicker.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataFluc dataFluc = new DataFluc();
|
||||||
|
dataFluc.setTime(item.getTime());
|
||||||
|
dataFluc.setLineId(item.getLineId());
|
||||||
|
dataFluc.setPhaseType(item.getPhaseType());
|
||||||
|
dataFluc.setValueType(item.getValueType());
|
||||||
|
dataFluc.setClDid(item.getClDid());
|
||||||
|
dataFluc.setProcess(item.getProcess());
|
||||||
|
dataFluc.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmPhasicI dataHarmPhasicI = new DataHarmPhasicI();
|
||||||
|
dataHarmPhasicI.setTime(item.getTime());
|
||||||
|
dataHarmPhasicI.setLineId(item.getLineId());
|
||||||
|
dataHarmPhasicI.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmPhasicI.setValueType(item.getValueType());
|
||||||
|
dataHarmPhasicI.setClDid(item.getClDid());
|
||||||
|
dataHarmPhasicI.setProcess(item.getProcess());
|
||||||
|
dataHarmPhasicI.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmPhasicV dataHarmPhasicV = new DataHarmPhasicV();
|
||||||
|
dataHarmPhasicV.setTime(item.getTime());
|
||||||
|
dataHarmPhasicV.setLineId(item.getLineId());
|
||||||
|
dataHarmPhasicV.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmPhasicV.setValueType(item.getValueType());
|
||||||
|
dataHarmPhasicV.setClDid(item.getClDid());
|
||||||
|
dataHarmPhasicV.setProcess(item.getProcess());
|
||||||
|
dataHarmPhasicV.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmPowerP dataHarmPowerP = new DataHarmPowerP();
|
||||||
|
dataHarmPowerP.setTime(item.getTime());
|
||||||
|
dataHarmPowerP.setLineId(item.getLineId());
|
||||||
|
dataHarmPowerP.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmPowerP.setValueType(item.getValueType());
|
||||||
|
dataHarmPowerP.setClDid(item.getClDid());
|
||||||
|
dataHarmPowerP.setProcess(item.getProcess());
|
||||||
|
dataHarmPowerP.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmPowerQ dataHarmPowerQ = new DataHarmPowerQ();
|
||||||
|
dataHarmPowerQ.setTime(item.getTime());
|
||||||
|
dataHarmPowerQ.setLineId(item.getLineId());
|
||||||
|
dataHarmPowerQ.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmPowerQ.setValueType(item.getValueType());
|
||||||
|
dataHarmPowerQ.setClDid(item.getClDid());
|
||||||
|
dataHarmPowerQ.setProcess(item.getProcess());
|
||||||
|
dataHarmPowerQ.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmPowerS dataHarmPowerS = new DataHarmPowerS();
|
||||||
|
dataHarmPowerS.setTime(item.getTime());
|
||||||
|
dataHarmPowerS.setLineId(item.getLineId());
|
||||||
|
dataHarmPowerS.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmPowerS.setValueType(item.getValueType());
|
||||||
|
dataHarmPowerS.setClDid(item.getClDid());
|
||||||
|
dataHarmPowerS.setProcess(item.getProcess());
|
||||||
|
dataHarmPowerS.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmRateV dataHarmRateV = new DataHarmRateV();
|
||||||
|
dataHarmRateV.setTime(item.getTime());
|
||||||
|
dataHarmRateV.setLineId(item.getLineId());
|
||||||
|
dataHarmRateV.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmRateV.setValueType(item.getValueType());
|
||||||
|
dataHarmRateV.setClDid(item.getClDid());
|
||||||
|
dataHarmRateV.setProcess(item.getProcess());
|
||||||
|
dataHarmRateV.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmRateI dataHarmRateI = new DataHarmRateI();
|
||||||
|
dataHarmRateI.setTime(item.getTime());
|
||||||
|
dataHarmRateI.setLineId(item.getLineId());
|
||||||
|
dataHarmRateI.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmRateI.setValueType(item.getValueType());
|
||||||
|
dataHarmRateI.setClDid(item.getClDid());
|
||||||
|
dataHarmRateI.setProcess(item.getProcess());
|
||||||
|
dataHarmRateI.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataInHarmV dataInHarmV = new DataInHarmV();
|
||||||
|
dataInHarmV.setTime(item.getTime());
|
||||||
|
dataInHarmV.setLineId(item.getLineId());
|
||||||
|
dataInHarmV.setPhaseType(item.getPhaseType());
|
||||||
|
dataInHarmV.setValueType(item.getValueType());
|
||||||
|
dataInHarmV.setClDid(item.getClDid());
|
||||||
|
dataInHarmV.setProcess(item.getProcess());
|
||||||
|
dataInHarmV.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataPlt dataPlt = new DataPlt();
|
||||||
|
dataPlt.setTime(item.getTime());
|
||||||
|
dataPlt.setLineId(item.getLineId());
|
||||||
|
dataPlt.setPhaseType(item.getPhaseType());
|
||||||
|
dataPlt.setValueType(item.getValueType());
|
||||||
|
dataPlt.setClDid(item.getClDid());
|
||||||
|
dataPlt.setProcess(item.getProcess());
|
||||||
|
dataPlt.setQualityFlag("0");
|
||||||
|
|
||||||
|
PqdData pqdData = new PqdData();
|
||||||
|
pqdData.setTime(item.getTime());
|
||||||
|
pqdData.setLineId(item.getLineId());
|
||||||
|
pqdData.setPhaseType(item.getPhaseType());
|
||||||
|
pqdData.setValueType(item.getValueType());
|
||||||
|
pqdData.setClDid(item.getClDid());
|
||||||
|
pqdData.setProcess(item.getProcess());
|
||||||
|
pqdData.setQualityFlag("0");
|
||||||
|
|
||||||
|
|
||||||
|
boolean hasDataV = false;
|
||||||
|
boolean hasDataI = false;
|
||||||
|
boolean hasData1 = false;
|
||||||
|
boolean hasData2 = false;
|
||||||
|
boolean hasData3 = false;
|
||||||
|
boolean hasData4 = false;
|
||||||
|
boolean hasData5 = false;
|
||||||
|
boolean hasData6 = false;
|
||||||
|
boolean hasData7 = false;
|
||||||
|
boolean hasData8 = false;
|
||||||
|
boolean hasData9 = false;
|
||||||
|
boolean hasData10 = false;
|
||||||
|
boolean hasData11 = false;
|
||||||
|
boolean hasData12 = false;
|
||||||
|
|
||||||
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||||
|
String fieldName = entry.getKey();
|
||||||
|
Object value = entry.getValue();
|
||||||
|
String capitalizedFieldName = StringUtils.capitalize(fieldName);
|
||||||
|
|
||||||
|
// 跳过公共字段和 null 值
|
||||||
|
if (isCommonField(fieldName) || value == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String table = map1.get(capitalizedFieldName);
|
||||||
|
if (StrUtil.isBlank(table)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<EleEpdPqd> epdPqdList = map2.get(capitalizedFieldName);
|
||||||
|
if (CollectionUtils.isEmpty(epdPqdList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String influxdbName2 = epdPqdList.get(0).getOtherName();
|
||||||
|
if (StrUtil.isBlank(influxdbName2) || influxdbName2.equals(capitalizedFieldName)) {
|
||||||
|
influxdbName2 = capitalizedFieldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Objects.equals(table, "data_v")) {
|
||||||
|
setFieldValue(dataV, influxdbName2, value, true);
|
||||||
|
hasDataV = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_i")) {
|
||||||
|
setFieldValue(dataI, influxdbName2, value, true);
|
||||||
|
hasDataI = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_flicker")) {
|
||||||
|
setFieldValue(dataFlicker, influxdbName2, value, true);
|
||||||
|
hasData1 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_fluc")) {
|
||||||
|
setFieldValue(dataFluc, influxdbName2, value, true);
|
||||||
|
hasData2 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmphasic_i")) {
|
||||||
|
setFieldValue(dataHarmPhasicI, influxdbName2, value, true);
|
||||||
|
hasData3 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmphasic_v")) {
|
||||||
|
setFieldValue(dataHarmPhasicV, influxdbName2, value, true);
|
||||||
|
hasData4 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmpower_p")) {
|
||||||
|
setFieldValue(dataHarmPowerP, influxdbName2, value, true);
|
||||||
|
hasData5 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmpower_q")) {
|
||||||
|
setFieldValue(dataHarmPowerQ, influxdbName2, value, true);
|
||||||
|
hasData6 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmpower_s")) {
|
||||||
|
setFieldValue(dataHarmPowerS, influxdbName2, value, true);
|
||||||
|
hasData7 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmrate_v")) {
|
||||||
|
setFieldValue(dataHarmRateV, influxdbName2, value, true);
|
||||||
|
hasData8 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmrate_i")) {
|
||||||
|
setFieldValue(dataHarmRateI, influxdbName2, value, true);
|
||||||
|
hasData9 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_inharm_v")) {
|
||||||
|
setFieldValue(dataInHarmV, influxdbName2, value, true);
|
||||||
|
hasData10 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_plt")) {
|
||||||
|
setFieldValue(dataPlt, influxdbName2, value, true);
|
||||||
|
hasData11 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "pqd_data")) {
|
||||||
|
setFieldValue(pqdData, StringUtils.uncapitalize(influxdbName2), value, false);
|
||||||
|
hasData12 = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasDataV) {
|
||||||
|
list1.add(dataV);
|
||||||
|
}
|
||||||
|
if (hasDataI) {
|
||||||
|
list2.add(dataI);
|
||||||
|
}
|
||||||
|
if (hasData1) {
|
||||||
|
list3.add(dataFlicker);
|
||||||
|
}
|
||||||
|
if (hasData2) {
|
||||||
|
list4.add(dataFluc);
|
||||||
|
}
|
||||||
|
if (hasData3) {
|
||||||
|
list5.add(dataHarmPhasicI);
|
||||||
|
}
|
||||||
|
if (hasData4) {
|
||||||
|
list6.add(dataHarmPhasicV);
|
||||||
|
}
|
||||||
|
if (hasData5) {
|
||||||
|
list7.add(dataHarmPowerP);
|
||||||
|
}
|
||||||
|
if (hasData6) {
|
||||||
|
list8.add(dataHarmPowerQ);
|
||||||
|
}
|
||||||
|
if (hasData7) {
|
||||||
|
list9.add(dataHarmPowerS);
|
||||||
|
}
|
||||||
|
if (hasData8) {
|
||||||
|
list10.add(dataHarmRateV);
|
||||||
|
}
|
||||||
|
if (hasData9) {
|
||||||
|
list11.add(dataHarmRateI);
|
||||||
|
}
|
||||||
|
if (hasData10) {
|
||||||
|
list12.add(dataInHarmV);
|
||||||
|
}
|
||||||
|
if (hasData11) {
|
||||||
|
list13.add(dataPlt);
|
||||||
|
}
|
||||||
|
if (hasData12) {
|
||||||
|
list14.add(pqdData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
map3.put("data_v", list1);
|
||||||
|
map3.put("data_i", list2);
|
||||||
|
map3.put("data_flicker", list3);
|
||||||
|
map3.put("data_fluc", list4);
|
||||||
|
map3.put("data_harmphasic_i", list5);
|
||||||
|
map3.put("data_harmphasic_v", list6);
|
||||||
|
map3.put("data_harmpower_p", list7);
|
||||||
|
map3.put("data_harmpower_q", list8);
|
||||||
|
map3.put("data_harmpower_s", list9);
|
||||||
|
map3.put("data_harmrate_v", list10);
|
||||||
|
map3.put("data_harmrate_i", list11);
|
||||||
|
map3.put("data_inharm_v", list12);
|
||||||
|
map3.put("data_plt", list13);
|
||||||
|
map3.put("pqd_data", list14);
|
||||||
|
return map3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Map<String, Object> extractFieldValues(PqdData pqdData) {
|
||||||
|
Map<String, Object> fieldValues = new HashMap<>();
|
||||||
|
Field[] fields = PqdData.class.getDeclaredFields();
|
||||||
|
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
try {
|
||||||
|
Object value = field.get(pqdData);
|
||||||
|
if (value != null) {
|
||||||
|
fieldValues.put(field.getName(), value);
|
||||||
|
} else {
|
||||||
|
fieldValues.put(field.getName(), 0.0d);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
log.warn("获取字段 {} 的值失败", field.getName(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fieldValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean isCommonField(String fieldName) {
|
||||||
|
Set<String> commonFields = new HashSet<>(Arrays.asList(
|
||||||
|
"time", "lineId", "phasicType", "valueType", "clDid",
|
||||||
|
"process", "qualityFlag"
|
||||||
|
));
|
||||||
|
return commonFields.contains(fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setFieldValue(Object obj, String fieldName, Object value, boolean isCamelCase) {
|
||||||
|
try {
|
||||||
|
String camelCaseFieldName = fieldName;
|
||||||
|
if (isCamelCase) {
|
||||||
|
camelCaseFieldName = toCamelCase(fieldName);
|
||||||
|
}
|
||||||
|
Field field = obj.getClass().getDeclaredField(camelCaseFieldName);
|
||||||
|
field.setAccessible(true);
|
||||||
|
if (value == null) {
|
||||||
|
Class<?> fieldType = field.getType();
|
||||||
|
if (fieldType == Double.class || fieldType == double.class) {
|
||||||
|
value = 0.0D;
|
||||||
|
} else if (fieldType == Integer.class || fieldType == int.class) {
|
||||||
|
value = 0;
|
||||||
|
} else if (fieldType == Float.class || fieldType == float.class) {
|
||||||
|
value = 0.0F;
|
||||||
|
} else if (fieldType == Long.class || fieldType == long.class) {
|
||||||
|
value = 0L;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
field.set(obj, value);
|
||||||
|
} catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) {
|
||||||
|
log.warn("设置字段 {} 的值失败", fieldName, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String toCamelCase(String input) {
|
||||||
|
if (input == null || input.isEmpty()) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
|
boolean toUpper = false;
|
||||||
|
|
||||||
|
for (char c : input.toCharArray()) {
|
||||||
|
if (c == '_') {
|
||||||
|
toUpper = true;
|
||||||
|
} else {
|
||||||
|
if (toUpper) {
|
||||||
|
result.append(Character.toUpperCase(c));
|
||||||
|
toUpper = false;
|
||||||
|
} else {
|
||||||
|
result.append(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 确保首字母小写,以匹配Java实体字段命名规范
|
||||||
|
if (result.length() > 0 && Character.isUpperCase(result.charAt(0))) {
|
||||||
|
result.setCharAt(0, Character.toLowerCase(result.charAt(0)));
|
||||||
|
}
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private EleEpdPqd copyEleEpdPqd(EleEpdPqd source) {
|
||||||
|
if (source == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
EleEpdPqd target = new EleEpdPqd();
|
||||||
|
BeanUtils.copyProperties(source, target);
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@ package com.njcn.csdevice.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
@@ -68,8 +67,8 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
List<CsLinePO> csLinePOList = csLineFeignClient.getLinesByDevList(devIdList).getData();
|
List<CsLinePO> csLinePOList = csLineFeignClient.getLinesByDevList(devIdList).getData();
|
||||||
csLinePOList.forEach(item->{
|
csLinePOList.forEach(item->{
|
||||||
//没有统计间隔就计算下一次监测点
|
//没有统计间隔就计算下一次监测点
|
||||||
if (Objects.isNull(item.getLineInterval())) {
|
if (Objects.isNull(item.getLineInterval()) || item.getLineInterval() == 0) {
|
||||||
return;
|
item.setLineInterval(1);
|
||||||
}
|
}
|
||||||
//应收数据
|
//应收数据
|
||||||
int dueCount = 1440 / item.getLineInterval();
|
int dueCount = 1440 / item.getLineInterval();
|
||||||
@@ -79,17 +78,11 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
RStatIntegrityD data = new RStatIntegrityD();
|
RStatIntegrityD data = new RStatIntegrityD();
|
||||||
//治理监测点
|
//治理监测点
|
||||||
if (item.getClDid() == 0) {
|
if (item.getClDid() == 0) {
|
||||||
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"apf_data","Apf_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"apf_data","Apf_Freq","value","T","AVG",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//云前置监测点
|
//云前置监测点 && 治理、无线监测点
|
||||||
if (ObjectUtil.isNotNull(item.getLineNo())) {
|
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"data_v","freq","value","T","AVG",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
||||||
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"data_v","Pq_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
|
||||||
}
|
|
||||||
//治理、无线监测点
|
|
||||||
else {
|
|
||||||
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"pqd_data","Pq_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
data.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
data.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
||||||
data.setLineIndex(item.getLineId());
|
data.setLineIndex(item.getLineId());
|
||||||
|
|||||||
@@ -16,13 +16,10 @@ import com.njcn.csdevice.service.ICsCommunicateService;
|
|||||||
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
||||||
import com.njcn.csdevice.util.TimeUtil;
|
import com.njcn.csdevice.util.TimeUtil;
|
||||||
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
import com.njcn.influx.deprecated.InfluxDBPublicParam;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -62,46 +59,93 @@ public class RStatOnlineRateDServiceImpl extends MppServiceImpl<RStatOnlineRateD
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(devList)) {
|
int onlineMinutes = 0;
|
||||||
//获取需要计算的时间
|
//获取需要计算的时间
|
||||||
List<String> dateRange = TimeUtil.getDateRangeAsString(param.getStartTime(), param.getEndTime());
|
List<String> dateRange = TimeUtil.getDateRangeAsString(param.getStartTime(), param.getEndTime());
|
||||||
for (String time : dateRange) {
|
for (String time : dateRange) {
|
||||||
List<PqsCommunicateDto> outCommunicateData = new ArrayList<>();
|
Date statDate = DateUtil.parse(time);
|
||||||
|
// 按设备分别统计
|
||||||
|
for (CsEquipmentDeliveryPO device : devList) {
|
||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(time + " 00:00:00");
|
lineParam.setLineId(Collections.singletonList(device.getId()));
|
||||||
lineParam.setEndTime(time + " 23:59:59");
|
lineParam.setStartTime(time);
|
||||||
for (CsEquipmentDeliveryPO s : devList) {
|
lineParam.setEndTime(time);
|
||||||
lineParam.setLineId(Collections.singletonList(s.getId()));
|
List<PqsCommunicateDto> dayData = pqsCommunicateService.getRawData2(lineParam);
|
||||||
List<PqsCommunicateDto> data = pqsCommunicateService.getRawDataLatest(lineParam);
|
if (CollectionUtil.isNotEmpty(dayData)) {
|
||||||
if (CollectionUtil.isEmpty(data)) {
|
if (dayData.size() == 1) {
|
||||||
PqsCommunicateDto dto = new PqsCommunicateDto();
|
PqsCommunicateDto singleRecord = dayData.get(0);
|
||||||
dto.setTime(time + " 00:00:00");
|
long minutesFromMidnight = DateUtil.between(statDate, DateUtil.parse(singleRecord.getTime()), DateUnit.MINUTE);
|
||||||
dto.setDevId(s.getId());
|
if (online.equals(singleRecord.getType())) {
|
||||||
if (s.getRunStatus() == 1) {
|
// 如果是在线状态,则从该时间点之后都在线
|
||||||
dto.setType(0);
|
onlineMinutes = 1440 - (int) minutesFromMidnight;
|
||||||
dto.setDescription("通讯中断");
|
} else {
|
||||||
} else if (s.getRunStatus() == 2) {
|
// 如果是离线状态,则从该时间点之前都在线(假设之前是在线的)
|
||||||
dto.setType(1);
|
onlineMinutes = (int) minutesFromMidnight;
|
||||||
dto.setDescription("通讯正常");
|
|
||||||
}
|
}
|
||||||
outCommunicateData.add(dto);
|
} else {
|
||||||
|
// 多条记录,逐段计算
|
||||||
|
long totalOnlineMinutes = 0L;
|
||||||
|
Date lastTime = statDate;
|
||||||
|
|
||||||
|
for (int i = 0; i < dayData.size(); i++) {
|
||||||
|
PqsCommunicateDto current = dayData.get(i);
|
||||||
|
Date currentTime = DateUtil.parse(current.getTime());
|
||||||
|
long intervalMinutes = DateUtil.between(lastTime, currentTime, DateUnit.MINUTE);
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
// 处理第一段:从0点到第一条记录
|
||||||
|
// 如果第一条记录是离线(type=0),则之前是在线;如果第一条是在线(type=1),则之前是离线
|
||||||
|
if (!online.equals(current.getType())) {
|
||||||
|
totalOnlineMinutes += intervalMinutes;
|
||||||
}
|
}
|
||||||
outCommunicateData.addAll(data);
|
} else {
|
||||||
|
// 处理后续段:根据上一条记录的状态判断
|
||||||
|
if (online.equals(dayData.get(i - 1).getType())) {
|
||||||
|
totalOnlineMinutes += intervalMinutes;
|
||||||
}
|
}
|
||||||
Date dateOut = DateUtil.parse(time);
|
}
|
||||||
for (PqsCommunicateDto pqsCommunicate : outCommunicateData) {
|
|
||||||
|
lastTime = currentTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理最后一段:从最后一条记录到当天结束
|
||||||
|
Date endOfDay = DateUtil.beginOfDay(DateUtil.offsetDay(statDate, 1));
|
||||||
|
long lastInterval = DateUtil.between(lastTime, endOfDay, DateUnit.MINUTE);
|
||||||
|
if (online.equals(dayData.get(dayData.size() - 1).getType())) {
|
||||||
|
totalOnlineMinutes += lastInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
onlineMinutes = (int) Math.min(totalOnlineMinutes, 1440);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<PqsCommunicateDto> firstData = pqsCommunicateService.getRawDataOne(lineParam);
|
||||||
|
if (CollectionUtil.isNotEmpty(firstData)) {
|
||||||
|
Date statDate2 = DateUtil.parse(firstData.get(0).getTime());
|
||||||
|
if (statDate.before(statDate2)) {
|
||||||
|
onlineMinutes = 0;
|
||||||
|
} else {
|
||||||
|
List<PqsCommunicateDto> latestData = pqsCommunicateService.getRawDataLatest(lineParam);
|
||||||
|
if (online.equals(latestData.get(0).getType())){
|
||||||
|
onlineMinutes = 1440;
|
||||||
|
} else {
|
||||||
|
onlineMinutes = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//如果设备连一条记录没有,那就根本没接入,不需要统计
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RStatOnlineRateD po = new RStatOnlineRateD();
|
RStatOnlineRateD po = new RStatOnlineRateD();
|
||||||
Date newDate = DateUtil.parse(pqsCommunicate.getTime());
|
|
||||||
lineParam.setLineId(Collections.singletonList(pqsCommunicate.getDevId()));
|
|
||||||
RStatOnlineRateD onLineRate = onLineMinute(newDate, dateOut, pqsCommunicate.getType(), lineParam);
|
|
||||||
po.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
po.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
||||||
po.setDevIndex(pqsCommunicate.getDevId());
|
po.setDevIndex(device.getId());
|
||||||
po.setOnlineMin(onLineRate.getOnlineMin());
|
po.setOnlineMin(onlineMinutes);
|
||||||
po.setOfflineMin(onLineRate.getOfflineMin());
|
po.setOfflineMin(1440 - onlineMinutes);
|
||||||
list.add(po);
|
list.add(po);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
this.saveOrUpdateBatchByMultiId(list, 1000);
|
this.saveOrUpdateBatchByMultiId(list, 1000);
|
||||||
}
|
}
|
||||||
@@ -114,97 +158,4 @@ public class RStatOnlineRateDServiceImpl extends MppServiceImpl<RStatOnlineRateD
|
|||||||
.between(RStatOnlineRateD::getTimeId,startTime,endTime)
|
.between(RStatOnlineRateD::getTimeId,startTime,endTime)
|
||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* new的时间和当前统计时间 不是/是 同一天
|
|
||||||
*/
|
|
||||||
private RStatOnlineRateD onLineMinute(Date newDate, Date date, Integer type, LineCountEvaluateParam lineParam) {
|
|
||||||
RStatOnlineRateD onLineRate = new RStatOnlineRateD();
|
|
||||||
Integer minute = 0;
|
|
||||||
/*new的时间和当前统计时间是同一天*/
|
|
||||||
if (DateUtil.isSameDay(newDate, date)) {
|
|
||||||
minute = processData(newDate, date, type, lineParam);
|
|
||||||
} else {
|
|
||||||
/*new的时间和当前统计时间不是同一天*/
|
|
||||||
Date nowDate = new Date();
|
|
||||||
/*数据补招的情况下*/
|
|
||||||
if (DateUtil.between(date, nowDate, DateUnit.DAY) > DateUtil.between(newDate, nowDate, DateUnit.DAY)) {
|
|
||||||
minute = processData(newDate, date, null, lineParam);
|
|
||||||
} else {
|
|
||||||
if (online.equals(type)) {
|
|
||||||
minute = InfluxDBPublicParam.DAY_MINUTE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onLineRate.setOnlineMin(minute);
|
|
||||||
onLineRate.setOfflineMin(InfluxDBPublicParam.DAY_MINUTE - minute);
|
|
||||||
return onLineRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Integer processData(Date newDate, Date date, Integer type,LineCountEvaluateParam lineParam) {
|
|
||||||
int minute = 0;
|
|
||||||
List<PqsCommunicateDto> communicateData = pqsCommunicateService.getRawData(lineParam);
|
|
||||||
/*当前统计时间内存在多条数据*/
|
|
||||||
if (communicateData.size() > 1) {
|
|
||||||
Date lastTime = null;
|
|
||||||
long onlineTime = 0;
|
|
||||||
long offlineTime = 0;
|
|
||||||
for (int i = 0; i < communicateData.size(); i++) {
|
|
||||||
long differ;
|
|
||||||
if (i == 0) {
|
|
||||||
/*首次比较取统计时间*/
|
|
||||||
differ = DateUtil.between(date, DateUtil.parse(communicateData.get(i).getTime()), DateUnit.MINUTE);
|
|
||||||
} else {
|
|
||||||
/*后续取上一次数据时间*/
|
|
||||||
differ = DateUtil.between(lastTime, DateUtil.parse(communicateData.get(i).getTime()), DateUnit.MINUTE);
|
|
||||||
}
|
|
||||||
if (online.equals(communicateData.get(i).getType())) {
|
|
||||||
offlineTime = offlineTime + differ;
|
|
||||||
} else {
|
|
||||||
onlineTime = onlineTime + differ;
|
|
||||||
}
|
|
||||||
lastTime = DateUtil.parse(communicateData.get(i).getTime());
|
|
||||||
}
|
|
||||||
if (online.equals(communicateData.get(communicateData.size() - 1).getType())) {
|
|
||||||
minute = InfluxDBPublicParam.DAY_MINUTE - (int) offlineTime;
|
|
||||||
} else {
|
|
||||||
minute = (int) onlineTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*当前统计时间内仅有一条数据*/
|
|
||||||
else {
|
|
||||||
if (type != null) {
|
|
||||||
long differ = DateUtil.between(date, newDate, DateUnit.MINUTE);
|
|
||||||
if (online.equals(type)) {
|
|
||||||
minute = InfluxDBPublicParam.DAY_MINUTE - (int) differ;
|
|
||||||
} else {
|
|
||||||
minute = (int) differ;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
List<PqsCommunicateDto> communicateDataOld = pqsCommunicateService.getRawDataEnd(lineParam);
|
|
||||||
// if (!communicateDataOld.isEmpty()){
|
|
||||||
// if (online.equals(communicateDataOld.get(0).getType())){
|
|
||||||
// minute = InfluxDBPublicParam.DAY_MINUTE;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (!communicateDataOld.isEmpty()){
|
|
||||||
try {
|
|
||||||
if (online.equals(communicateDataOld.get(0).getType())){
|
|
||||||
minute = (int) DateUtil.between(new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN).parse(communicateDataOld.get(0).getTime()), new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN).parse(lineParam.getEndTime()), DateUnit.MINUTE);
|
|
||||||
} else {
|
|
||||||
minute = (int) DateUtil.between(new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN).parse(lineParam.getStartTime()), new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN).parse(communicateDataOld.get(0).getTime()), DateUnit.MINUTE);
|
|
||||||
}
|
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
minute = InfluxDBPublicParam.DAY_MINUTE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return minute;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,24 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
List<String> collect = new ArrayList<>();
|
List<String> collect = new ArrayList<>();
|
||||||
if(Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER_8000.getCode())){
|
if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
|
||||||
|
Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
||||||
|
QueryWrapper<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
||||||
|
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
||||||
|
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
||||||
|
collect = csMarketData.stream().map(CsMarketData::getEngineerId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
} else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
|
||||||
|
//todo查询配置的游客工程
|
||||||
|
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
||||||
|
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getEnginerId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
}
|
||||||
|
// ||Objects.equals(role,"bxs_user")
|
||||||
|
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode()) || Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||||
|
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
|
||||||
|
collect =csEngineeringPOS.stream().filter(temp->Objects.equals(temp.getStatus(),"1")).map(CsEngineeringPO::getId).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
csDeviceUserPOQueryWrapper.clear();
|
csDeviceUserPOQueryWrapper.clear();
|
||||||
csEngineeringUserPOQueryWrapper.clear();
|
csEngineeringUserPOQueryWrapper.clear();
|
||||||
csLedgerQueryWrapper.clear();
|
csLedgerQueryWrapper.clear();
|
||||||
@@ -79,24 +96,6 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
collect = collect.stream().distinct().collect(Collectors.toList());
|
collect = collect.stream().distinct().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
return collect;
|
return collect;
|
||||||
|
|
||||||
} else if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
|
|
||||||
Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
|
||||||
QueryWrapper<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
|
||||||
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
|
||||||
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
|
||||||
collect = csMarketData.stream().map(CsMarketData::getEngineerId).collect(Collectors.toList());
|
|
||||||
|
|
||||||
} else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
|
|
||||||
//todo查询配置的游客工程
|
|
||||||
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
|
||||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getEnginerId).distinct().collect(Collectors.toList());
|
|
||||||
|
|
||||||
}
|
|
||||||
// ||Objects.equals(role,"bxs_user")
|
|
||||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode()) || Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER.getCode()) ){
|
|
||||||
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
|
|
||||||
collect =csEngineeringPOS.stream().filter(temp->Objects.equals(temp.getStatus(),"1")).map(CsEngineeringPO::getId).collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return collect;
|
return collect;
|
||||||
@@ -115,37 +114,11 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
List<String> collect = new ArrayList<>();
|
List<String> collect = new ArrayList<>();
|
||||||
if(
|
|
||||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER_8000.getCode()) || Objects.equals(role,"bxs_user")){
|
|
||||||
csDeviceUserPOQueryWrapper.clear();
|
|
||||||
csDeviceUserPOQueryWrapper.eq("status","1").and(wq -> {
|
|
||||||
wq.eq("primary_user_id", userIndex)
|
|
||||||
.or()
|
|
||||||
.eq("sub_user_id",userIndex);
|
|
||||||
});
|
|
||||||
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
|
|
||||||
if(CollectionUtils.isEmpty(csDeviceUserPOS)){
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
|
||||||
return collect1;
|
|
||||||
|
|
||||||
}
|
|
||||||
//fix 新需求 工程用户可以看到关注工程的设备和对应的主用户和子用户的设备
|
//fix 新需求 工程用户可以看到关注工程的设备和对应的主用户和子用户的设备
|
||||||
//note 这边工程用户不查询主设备,只看关注的工程,做下调整,不然会出现工程用户未关注任何工程,但是有一台主设备,导致界面有数据
|
//note 这边工程用户不查询主设备,只看关注的工程,做下调整,不然会出现工程用户未关注任何工程,但是有一台主设备,导致界面有数据
|
||||||
else if (Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
if (Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
||||||
List<String> sumDevId = new ArrayList<>();
|
List<String> sumDevId = new ArrayList<>();
|
||||||
csDeviceUserPOQueryWrapper.clear();
|
csDeviceUserPOQueryWrapper.clear();
|
||||||
// csDeviceUserPOQueryWrapper.eq("status","1").and(wq -> {
|
|
||||||
// wq.eq("primary_user_id", userIndex)
|
|
||||||
// .or()
|
|
||||||
// .eq("sub_user_id",userIndex);
|
|
||||||
// });
|
|
||||||
// List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
|
|
||||||
// if(!CollectionUtils.isEmpty(csDeviceUserPOS)){
|
|
||||||
// sumDevId = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
|
||||||
// }
|
|
||||||
|
|
||||||
QueryWrapper<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
||||||
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
||||||
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
||||||
@@ -198,15 +171,25 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getDeviceId).distinct().collect(Collectors.toList());
|
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
}
|
}
|
||||||
// ||Objects.equals(role,"bxs_user")
|
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER.getCode())){
|
|
||||||
csLedgerQueryWrapper.clear();
|
csLedgerQueryWrapper.clear();
|
||||||
csLedgerQueryWrapper.eq("level",2).eq("state",1);
|
csLedgerQueryWrapper.eq("level",2).eq("state",1);
|
||||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||||
collect = csLedgers.stream().map(CsLedger::getId).distinct().collect(Collectors.toList());
|
collect = csLedgers.stream().map(CsLedger::getId).distinct().collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
csDeviceUserPOQueryWrapper.clear();
|
||||||
|
csDeviceUserPOQueryWrapper.eq("status","1").and(wq -> {
|
||||||
|
wq.eq("primary_user_id", userIndex)
|
||||||
|
.or()
|
||||||
|
.eq("sub_user_id",userIndex);
|
||||||
|
});
|
||||||
|
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
|
||||||
|
if(CollectionUtils.isEmpty(csDeviceUserPOS)){
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
return collect1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return collect;
|
return collect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,417 +0,0 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.csdevice.mapper.CsSmsSendRecordMapper;
|
|
||||||
import com.njcn.csdevice.pojo.dto.CredentialReqDTO;
|
|
||||||
import com.njcn.csdevice.pojo.dto.SendResult;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsSmsSendRecord;
|
|
||||||
import com.njcn.csdevice.pojo.vo.MessageRecordReqVO;
|
|
||||||
import com.njcn.csdevice.service.ISmsSendService;
|
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.ConnectException;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.SocketTimeoutException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xy
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@AllArgsConstructor
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class SmsSendServiceImpl extends ServiceImpl<CsSmsSendRecordMapper, CsSmsSendRecord> implements ISmsSendService {
|
|
||||||
|
|
||||||
@Value("${msg.credential_url:http://192.168.2.126:48083/admin-api/push/credential/generate}")
|
|
||||||
private String CREDENTIAL_URL;
|
|
||||||
@Value("${msg.sms_send_url:http://192.168.2.126:48083/admin-api/push/message/send/sms}")
|
|
||||||
private String SMS_SEND_URL;
|
|
||||||
@Value("${msg.connect_timeout:5000}")
|
|
||||||
private Integer CONNECT_TIMEOUT;
|
|
||||||
@Value("${msg.read_timeout:30000}")
|
|
||||||
private Integer READ_TIMEOUT;
|
|
||||||
@Value("${msg.system_name:NPQS-9500}")
|
|
||||||
private String SYSTEM_NAME;
|
|
||||||
@Value("${msg.secret_key:123456}")
|
|
||||||
private String SECRET_KEY;
|
|
||||||
|
|
||||||
private static final int[] RETRY_DELAYS = {1, 2, 3};
|
|
||||||
private static final int MAX_RETRY = 3;
|
|
||||||
private static final String CREDENTIAL_CACHE_KEY = "SMS_CREDENTIAL_TOKEN";
|
|
||||||
private static final Gson GSON = new Gson();
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private RedisUtil redisUtil;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendSmsWithRetry(String receiver, String content, String messageType) {
|
|
||||||
MessageRecordReqVO vo = new MessageRecordReqVO();
|
|
||||||
vo.setReceiver(receiver);
|
|
||||||
vo.setContent(content);
|
|
||||||
vo.setMessageType(messageType);
|
|
||||||
sendSmsWithRetry(vo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendSmsWithRetry(MessageRecordReqVO messageRecordReqVO) {
|
|
||||||
CsSmsSendRecord record = initRecord(messageRecordReqVO);
|
|
||||||
|
|
||||||
this.save(record);
|
|
||||||
|
|
||||||
try {
|
|
||||||
String credentialToken = getOrRefreshCredentialWithRetry(record);
|
|
||||||
|
|
||||||
if (credentialToken == null) {
|
|
||||||
record.setSendStatus(0);
|
|
||||||
record.setFailReason("获取凭证失败,已重试3次");
|
|
||||||
log.error("获取凭证失败,短信未发送,接收者: {}", messageRecordReqVO.getReceiver());
|
|
||||||
this.updateById(record);
|
|
||||||
throw new BusinessException("获取凭证失败,已重试3次");
|
|
||||||
}
|
|
||||||
|
|
||||||
record.setCredentialToken(credentialToken);
|
|
||||||
record.setSendTime(LocalDateTime.now());
|
|
||||||
this.updateById(record);
|
|
||||||
|
|
||||||
boolean success = attemptSendWithRetry(messageRecordReqVO, credentialToken, record);
|
|
||||||
|
|
||||||
if (success) {
|
|
||||||
record.setSendStatus(1);
|
|
||||||
record.setFailReason(null);
|
|
||||||
log.info("短信发送成功,接收者: {}", messageRecordReqVO.getReceiver());
|
|
||||||
} else {
|
|
||||||
record.setSendStatus(0);
|
|
||||||
if (record.getFailReason() == null) {
|
|
||||||
record.setFailReason("超过最大重试次数,发送失败");
|
|
||||||
}
|
|
||||||
log.error("短信发送失败,接收者: {},已重试{}次,原因: {}",
|
|
||||||
messageRecordReqVO.getReceiver(), record.getRetryCount(), record.getFailReason());
|
|
||||||
throw new BusinessException("短信发送失败: " + record.getFailReason());
|
|
||||||
}
|
|
||||||
} catch (BusinessException e) {
|
|
||||||
record.setSendStatus(0);
|
|
||||||
record.setFailReason(e.getMessage());
|
|
||||||
log.error("短信发送业务异常,接收者: {}", messageRecordReqVO.getReceiver(), e);
|
|
||||||
this.updateById(record);
|
|
||||||
throw e;
|
|
||||||
} catch (Exception e) {
|
|
||||||
record.setSendStatus(0);
|
|
||||||
record.setFailReason("发送异常: " + e.getMessage());
|
|
||||||
log.error("短信发送异常,接收者: {}", messageRecordReqVO.getReceiver(), e);
|
|
||||||
this.updateById(record);
|
|
||||||
throw new BusinessException("短信发送异常: " + e.getMessage());
|
|
||||||
} finally {
|
|
||||||
this.updateById(record);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private CsSmsSendRecord initRecord(MessageRecordReqVO vo) {
|
|
||||||
CsSmsSendRecord record = new CsSmsSendRecord();
|
|
||||||
record.setReceiver(vo.getReceiver());
|
|
||||||
record.setContent(vo.getContent());
|
|
||||||
record.setMessageType(vo.getMessageType());
|
|
||||||
record.setSendStatus(-1);
|
|
||||||
record.setRetryCount(0);
|
|
||||||
record.setMaxRetry(MAX_RETRY);
|
|
||||||
record.setCreateTime(LocalDateTime.now());
|
|
||||||
return record;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getOrRefreshCredentialWithRetry(CsSmsSendRecord record) {
|
|
||||||
Object cachedToken = redisUtil.getObjectByKey(CREDENTIAL_CACHE_KEY);
|
|
||||||
if (cachedToken != null) {
|
|
||||||
log.info("使用缓存的凭证令牌");
|
|
||||||
return cachedToken.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("缓存中无凭证,开始获取新凭证(最多重试3次)");
|
|
||||||
|
|
||||||
for (int i = 1; i <= 3; i++) {
|
|
||||||
try {
|
|
||||||
String token = fetchNewCredential();
|
|
||||||
log.info("第{}次尝试获取凭证成功", i);
|
|
||||||
return token;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.warn("第{}次获取凭证失败: {}", i, e.getMessage());
|
|
||||||
|
|
||||||
record.setFailReason("获取凭证第" + i + "次失败: " + e.getMessage());
|
|
||||||
this.updateById(record);
|
|
||||||
|
|
||||||
try {
|
|
||||||
int waitSeconds = i * 10;
|
|
||||||
log.info("等待{}秒后重试...", waitSeconds);
|
|
||||||
TimeUnit.SECONDS.sleep(waitSeconds);
|
|
||||||
} catch (InterruptedException ie) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
log.error("凭证获取重试被中断");
|
|
||||||
record.setFailReason("获取凭证实例被中断");
|
|
||||||
this.updateById(record);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.error("获取凭证失败,已重试3次");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String fetchNewCredential() {
|
|
||||||
CredentialReqDTO reqDTO = new CredentialReqDTO();
|
|
||||||
reqDTO.setSystemName(SYSTEM_NAME);
|
|
||||||
reqDTO.setSecretKey(SECRET_KEY);
|
|
||||||
|
|
||||||
HttpURLConnection connection = null;
|
|
||||||
try {
|
|
||||||
URL url = new URL(CREDENTIAL_URL);
|
|
||||||
connection = (HttpURLConnection) url.openConnection();
|
|
||||||
connection.setRequestMethod("POST");
|
|
||||||
connection.setRequestProperty("Content-Type", "application/json");
|
|
||||||
connection.setConnectTimeout(CONNECT_TIMEOUT);
|
|
||||||
connection.setReadTimeout(READ_TIMEOUT);
|
|
||||||
connection.setDoOutput(true);
|
|
||||||
|
|
||||||
OutputStream outputStream = connection.getOutputStream();
|
|
||||||
outputStream.write(GSON.toJson(reqDTO).getBytes(StandardCharsets.UTF_8));
|
|
||||||
outputStream.flush();
|
|
||||||
outputStream.close();
|
|
||||||
|
|
||||||
int responseCode = connection.getResponseCode();
|
|
||||||
if (responseCode != 200) {
|
|
||||||
throw new BusinessException("获取凭证失败,HTTP响应码: " + responseCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(
|
|
||||||
new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
|
|
||||||
StringBuilder response = new StringBuilder();
|
|
||||||
String inputLine;
|
|
||||||
while ((inputLine = reader.readLine()) != null) {
|
|
||||||
response.append(inputLine);
|
|
||||||
}
|
|
||||||
reader.close();
|
|
||||||
|
|
||||||
JsonObject jsonResponse = GSON.fromJson(response.toString(), JsonObject.class);
|
|
||||||
int code = jsonResponse.get("code").getAsInt();
|
|
||||||
|
|
||||||
if (code != 0) {
|
|
||||||
String msg = jsonResponse.has("msg") ? jsonResponse.get("msg").getAsString() : "未知错误";
|
|
||||||
throw new BusinessException("获取凭证失败,错误码: " + code + ",错误信息: " + msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonObject data = jsonResponse.getAsJsonObject("data");
|
|
||||||
String token = data.get("credentialToken").getAsString();
|
|
||||||
long expiresTimestamp = data.get("expiresTime").getAsLong();
|
|
||||||
|
|
||||||
LocalDateTime expiresTime = LocalDateTime.ofInstant(
|
|
||||||
Instant.ofEpochMilli(expiresTimestamp),
|
|
||||||
ZoneId.systemDefault()
|
|
||||||
);
|
|
||||||
|
|
||||||
long expireSeconds = calculateExpireSeconds(expiresTime);
|
|
||||||
redisUtil.saveByKeyWithExpire(CREDENTIAL_CACHE_KEY, token, expireSeconds);
|
|
||||||
|
|
||||||
log.info("获取新凭证成功,过期时间: {},缓存有效期: {}秒", expiresTime, expireSeconds);
|
|
||||||
return token;
|
|
||||||
|
|
||||||
} catch (SocketTimeoutException e) {
|
|
||||||
throw new BusinessException("获取凭证超时(30秒),请检查网络连接");
|
|
||||||
} catch (ConnectException e) {
|
|
||||||
throw new BusinessException("无法连接到凭证服务,请检查服务是否启动和网络是否正常");
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new BusinessException("获取凭证IO异常: " + e.getMessage());
|
|
||||||
} finally {
|
|
||||||
if (connection != null) {
|
|
||||||
connection.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private long calculateExpireSeconds(LocalDateTime expiresTime) {
|
|
||||||
long expireSeconds = java.time.Duration.between(
|
|
||||||
LocalDateTime.now(),
|
|
||||||
expiresTime
|
|
||||||
).getSeconds();
|
|
||||||
|
|
||||||
expireSeconds = expireSeconds - 60;
|
|
||||||
|
|
||||||
return Math.max(expireSeconds, 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean attemptSendWithRetry(MessageRecordReqVO vo, String token, CsSmsSendRecord record) {
|
|
||||||
for (int attempt = 0; attempt <= MAX_RETRY; attempt++) {
|
|
||||||
if (attempt > 0) {
|
|
||||||
int delayMinutes = RETRY_DELAYS[attempt - 1];
|
|
||||||
log.info("第{}次重试,等待{}分钟后发送...", attempt, delayMinutes);
|
|
||||||
|
|
||||||
try {
|
|
||||||
TimeUnit.MINUTES.sleep(delayMinutes);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
log.error("重试等待被中断", e);
|
|
||||||
record.setFailReason("重试等待被中断");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
record.setRetryCount(attempt);
|
|
||||||
}
|
|
||||||
|
|
||||||
SendResult result = executeSendSms(vo, token, record);
|
|
||||||
|
|
||||||
if (result.isSuccess()) {
|
|
||||||
record.setFailReason(null);
|
|
||||||
log.info("第{}次尝试发送成功,消息ID: {}", attempt, result.getMessageId());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
record.setFailReason(result.getFailReason());
|
|
||||||
|
|
||||||
if (result.isUnauthorized()) {
|
|
||||||
log.warn("凭证失效(401),重新获取凭证后重试...");
|
|
||||||
String newToken = getOrRefreshCredentialWithRetry(record);
|
|
||||||
if (newToken == null) {
|
|
||||||
record.setFailReason("凭证刷新失败,无法重新获取凭证");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
token = newToken;
|
|
||||||
record.setCredentialToken(newToken);
|
|
||||||
this.updateById(record);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!result.isTimeOut()) {
|
|
||||||
log.warn("发送失败且非超时,不再重试,原因: {},响应时间: {}ms",
|
|
||||||
result.getFailReason(), record.getResponseTime());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
log.warn("第{}次发送超时,将重试,响应时间: {}ms",
|
|
||||||
attempt, record.getResponseTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
record.setFailReason("超过最大重试次数,发送超时");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SendResult executeSendSms(MessageRecordReqVO vo, String token, CsSmsSendRecord record) {
|
|
||||||
HttpURLConnection connection = null;
|
|
||||||
long startTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
try {
|
|
||||||
URL url = new URL(SMS_SEND_URL);
|
|
||||||
connection = (HttpURLConnection) url.openConnection();
|
|
||||||
connection.setRequestMethod("POST");
|
|
||||||
connection.setRequestProperty("Content-Type", "application/json");
|
|
||||||
connection.setRequestProperty("X-Credential-Token", token);
|
|
||||||
connection.setConnectTimeout(CONNECT_TIMEOUT);
|
|
||||||
connection.setReadTimeout(READ_TIMEOUT);
|
|
||||||
connection.setDoOutput(true);
|
|
||||||
|
|
||||||
OutputStream outputStream = connection.getOutputStream();
|
|
||||||
outputStream.write(GSON.toJson(Collections.singletonList(vo)).getBytes(StandardCharsets.UTF_8));
|
|
||||||
outputStream.flush();
|
|
||||||
outputStream.close();
|
|
||||||
|
|
||||||
int responseCode = connection.getResponseCode();
|
|
||||||
long responseTime = System.currentTimeMillis() - startTime;
|
|
||||||
record.setResponseTime(responseTime);
|
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(
|
|
||||||
new InputStreamReader(
|
|
||||||
responseCode == 200 ? connection.getInputStream() : connection.getErrorStream(),
|
|
||||||
StandardCharsets.UTF_8
|
|
||||||
)
|
|
||||||
);
|
|
||||||
StringBuilder response = new StringBuilder();
|
|
||||||
String inputLine;
|
|
||||||
while ((inputLine = reader.readLine()) != null) {
|
|
||||||
response.append(inputLine);
|
|
||||||
}
|
|
||||||
reader.close();
|
|
||||||
|
|
||||||
if (responseCode != 200) {
|
|
||||||
String failReason = "HTTP响应码异常: " + responseCode;
|
|
||||||
if (response.length() > 0) {
|
|
||||||
failReason += ",响应: " + response.toString();
|
|
||||||
}
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
return new SendResult(false, null, failReason, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonObject jsonResponse = GSON.fromJson(response.toString(), JsonObject.class);
|
|
||||||
int code = jsonResponse.get("code").getAsInt();
|
|
||||||
|
|
||||||
if (code == 401) {
|
|
||||||
String failReason = "凭证失效(HTTP 401)";
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
redisUtil.delete(CREDENTIAL_CACHE_KEY);
|
|
||||||
return new SendResult(false, null, failReason, false, true);
|
|
||||||
} else {
|
|
||||||
if (code != 0) {
|
|
||||||
String msg = jsonResponse.has("msg") ? jsonResponse.get("msg").getAsString() : "未知错误";
|
|
||||||
String failReason = "业务错误码: " + code + ",错误信息: " + msg;
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
return new SendResult(false, null, failReason, false, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonObject firstResult = jsonResponse.getAsJsonArray("data").get(0).getAsJsonObject();
|
|
||||||
boolean result = firstResult.get("result").getAsBoolean();
|
|
||||||
String messageId = firstResult.has("messageId") ? firstResult.get("messageId").getAsString() : null;
|
|
||||||
String detail = firstResult.has("detail") ? firstResult.get("detail").getAsString() : null;
|
|
||||||
|
|
||||||
if (result) {
|
|
||||||
log.info("短信发送成功,接收者: {},消息ID: {},详情: {},耗时: {}ms",
|
|
||||||
vo.getReceiver(), messageId, detail, responseTime);
|
|
||||||
return new SendResult(true, messageId, null, false, false);
|
|
||||||
} else {
|
|
||||||
String failReason = "发送失败: " + detail;
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
return new SendResult(false, messageId, failReason, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SocketTimeoutException e) {
|
|
||||||
long responseTime = System.currentTimeMillis() - startTime;
|
|
||||||
record.setResponseTime(responseTime);
|
|
||||||
String failReason = "请求超时(30秒)";
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
log.warn("短信发送超时,接收者: {},耗时: {}ms", vo.getReceiver(), responseTime);
|
|
||||||
return new SendResult(false, null, failReason, true, false);
|
|
||||||
} catch (ConnectException e) {
|
|
||||||
long responseTime = System.currentTimeMillis() - startTime;
|
|
||||||
record.setResponseTime(responseTime);
|
|
||||||
String failReason = "无法连接到短信服务";
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
log.error("短信服务连接失败,接收者: {}", vo.getReceiver(), e);
|
|
||||||
return new SendResult(false, null, failReason, false, false);
|
|
||||||
} catch (IOException e) {
|
|
||||||
long responseTime = System.currentTimeMillis() - startTime;
|
|
||||||
record.setResponseTime(responseTime);
|
|
||||||
String failReason = "IO异常: " + e.getMessage();
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
log.error("短信发送IO异常,接收者: {},耗时: {}ms", vo.getReceiver(), responseTime, e);
|
|
||||||
return new SendResult(false, null, failReason, false, false);
|
|
||||||
} finally {
|
|
||||||
if (connection != null) {
|
|
||||||
connection.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -466,7 +466,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
if(param.getStatisticalId() == null){
|
if(param.getStatisticalId() == null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||||
for(WlRecord wl : data){
|
for(WlRecord wl : data){
|
||||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(wl.getLineId())).getData();
|
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(wl.getLineId())).getData();
|
||||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
||||||
@@ -482,11 +482,15 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
commonQueryParam.setLineId(temp.getLineId());
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
|
if (epdPqd.getName() == null || epdPqd.getName().isEmpty()) {
|
||||||
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
||||||
|
} else {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getOtherName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
||||||
|
}
|
||||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
commonQueryParam.setStartTime(LocalDateTimeUtil.format(wl.getStartTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
commonQueryParam.setStartTime(LocalDateTimeUtil.format(wl.getStartTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
||||||
commonQueryParam.setEndTime(LocalDateTimeUtil.format(wl.getEndTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
commonQueryParam.setEndTime(LocalDateTimeUtil.format(wl.getEndTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
||||||
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType().toUpperCase());
|
||||||
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||||
return commonQueryParam;
|
return commonQueryParam;
|
||||||
@@ -500,7 +504,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
String unit;
|
String unit;
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("T",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
@@ -677,13 +681,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
if(Objects.isNull(list.get(i).getEndTime())){
|
if(Objects.isNull(list.get(i).getEndTime())){
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
String sqlNow = now.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
String sqlNow = now.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper("pqd_data",StatisticalDataDTO.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper("data_v",StatisticalDataDTO.class);
|
||||||
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
||||||
.select(StatisticalDataDTO::getPhaseType)
|
.select(StatisticalDataDTO::getPhaseType)
|
||||||
.select(StatisticalDataDTO::getValueType)
|
.select(StatisticalDataDTO::getValueType)
|
||||||
.last("Pq_Freq")
|
.last("freq")
|
||||||
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
||||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,"M")
|
.eq(InfluxDBTableConstant.PHASIC_TYPE,"T")
|
||||||
.between(InfluxDBTableConstant.TIME,startSql,sqlNow);
|
.between(InfluxDBTableConstant.TIME,startSql,sqlNow);
|
||||||
System.out.println(influxQueryWrapper.generateSql());
|
System.out.println(influxQueryWrapper.generateSql());
|
||||||
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||||
@@ -704,13 +708,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
//如果不存在结束时间,则取后面一条的起始时间作为结束判断标识
|
//如果不存在结束时间,则取后面一条的起始时间作为结束判断标识
|
||||||
if(Objects.isNull(list.get(i).getEndTime())){
|
if(Objects.isNull(list.get(i).getEndTime())){
|
||||||
String end = list.get(i+1).getStartTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
String end = list.get(i+1).getStartTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper("pqd_data",StatisticalDataDTO.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper("data_v",StatisticalDataDTO.class);
|
||||||
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
||||||
.select(StatisticalDataDTO::getPhaseType)
|
.select(StatisticalDataDTO::getPhaseType)
|
||||||
.select(StatisticalDataDTO::getValueType)
|
.select(StatisticalDataDTO::getValueType)
|
||||||
.last("Pq_Freq")
|
.last("freq")
|
||||||
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
||||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,"M")
|
.eq(InfluxDBTableConstant.PHASIC_TYPE,"T")
|
||||||
.between(InfluxDBTableConstant.TIME,startSql,end);
|
.between(InfluxDBTableConstant.TIME,startSql,end);
|
||||||
System.out.println(influxQueryWrapper.generateSql());
|
System.out.println(influxQueryWrapper.generateSql());
|
||||||
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user