Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e7d12ab93 | |||
| 531a787c91 | |||
| 45d31a05ee | |||
| dfd035b908 | |||
| ab59d870d8 | |||
| 5a94b6d8b4 | |||
| cfc2b2b7ba | |||
| eec42f60c0 | |||
| 1d71006d3c | |||
| 1dc16ae071 |
@@ -82,6 +82,79 @@ public class EventDto {
|
|||||||
|
|
||||||
@SerializedName("Parm")
|
@SerializedName("Parm")
|
||||||
private List<Param> param;
|
private List<Param> param;
|
||||||
|
|
||||||
|
|
||||||
|
@SerializedName("PrjName")
|
||||||
|
@ApiModelProperty("工程名称")
|
||||||
|
private String prjName;
|
||||||
|
|
||||||
|
@SerializedName("PrjTimeStart")
|
||||||
|
@ApiModelProperty("装置启动时间")
|
||||||
|
private Long prjTimeStart;
|
||||||
|
|
||||||
|
@SerializedName("PrjTimeEnd")
|
||||||
|
@ApiModelProperty("装置结束时间")
|
||||||
|
private Long prjTimeEnd;
|
||||||
|
|
||||||
|
@SerializedName("PrjDataPath")
|
||||||
|
@ApiModelProperty("装置数据路径")
|
||||||
|
private String prjDataPath;
|
||||||
|
|
||||||
|
@SerializedName("DevType")
|
||||||
|
@ApiModelProperty("装置型号")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
@SerializedName("DevMac")
|
||||||
|
@ApiModelProperty("装置mac地址")
|
||||||
|
private String devMac;
|
||||||
|
|
||||||
|
@SerializedName("AppVersion")
|
||||||
|
@ApiModelProperty("装置程序版本")
|
||||||
|
private String appVersion;
|
||||||
|
|
||||||
|
@SerializedName("Cldid")
|
||||||
|
@ApiModelProperty("逻辑子设备id")
|
||||||
|
private Integer clDid;
|
||||||
|
|
||||||
|
@SerializedName("StatCycle")
|
||||||
|
@ApiModelProperty("统计间隔")
|
||||||
|
private Integer statCycle;
|
||||||
|
|
||||||
|
@SerializedName("VolGrade")
|
||||||
|
@ApiModelProperty("电压等级")
|
||||||
|
private Float volGrade;
|
||||||
|
|
||||||
|
@SerializedName("VolConType")
|
||||||
|
@ApiModelProperty("电压接线方式(0-星型, 1-角型, 2-V型)")
|
||||||
|
private Integer volConType;
|
||||||
|
|
||||||
|
@SerializedName("CurConSel")
|
||||||
|
@ApiModelProperty("电流接线方式(0-正常, 1-合成IB, 2-合成IC)")
|
||||||
|
private Integer curConSel;
|
||||||
|
|
||||||
|
@SerializedName("PtRatio")
|
||||||
|
@ApiModelProperty("PT变比")
|
||||||
|
private Integer ptRatio;
|
||||||
|
|
||||||
|
@SerializedName("CtRatio")
|
||||||
|
@ApiModelProperty("ct变比")
|
||||||
|
private Integer ctRatio;
|
||||||
|
|
||||||
|
@SerializedName("CapacitySscb")
|
||||||
|
@ApiModelProperty("基准短路容量")
|
||||||
|
private Float capacitySscb;
|
||||||
|
|
||||||
|
@SerializedName("CapacitySscmin")
|
||||||
|
@ApiModelProperty("最小短路容量")
|
||||||
|
private Float capacitySscmin;
|
||||||
|
|
||||||
|
@SerializedName("CapacitySt")
|
||||||
|
@ApiModelProperty("供电设备容量")
|
||||||
|
private Float capacitySt;
|
||||||
|
|
||||||
|
@SerializedName("CapacitySi")
|
||||||
|
@ApiModelProperty("用户协议容量")
|
||||||
|
private Float capacitySi;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class CsDeviceController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/wlRegister")
|
@PostMapping("/wlRegister")
|
||||||
@ApiOperation("便携式设备注册")
|
@ApiOperation("便携式设备接入")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "nDid", value = "设备识别码", required = true)
|
@ApiImplicitParam(name = "nDid", value = "设备识别码", required = true)
|
||||||
})
|
})
|
||||||
@@ -109,7 +109,7 @@ public class CsDeviceController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/wlAccess")
|
@PostMapping("/wlAccess")
|
||||||
@ApiOperation("便携式设备接入")
|
@ApiOperation("便携式设备手动接入")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "nDid", value = "设备识别码", required = true)
|
@ApiImplicitParam(name = "nDid", value = "设备识别码", required = true)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -73,40 +73,22 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
|
|||||||
public class MqttMessageHandler {
|
public class MqttMessageHandler {
|
||||||
|
|
||||||
private final DevModelFeignClient devModelFeignClient;
|
private final DevModelFeignClient devModelFeignClient;
|
||||||
|
|
||||||
private final ICsLineModelService csLineModelService;
|
private final ICsLineModelService csLineModelService;
|
||||||
|
|
||||||
private final ICsTopicService csTopicService;
|
private final ICsTopicService csTopicService;
|
||||||
|
|
||||||
private final MqttPublisher publisher;
|
private final MqttPublisher publisher;
|
||||||
|
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
|
|
||||||
private final ICsEquipmentDeliveryService csEquipmentDeliveryService;
|
private final ICsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||||
|
|
||||||
private final DataSetFeignClient dataSetFeignClient;
|
private final DataSetFeignClient dataSetFeignClient;
|
||||||
|
|
||||||
private final AppAutoDataMessageTemplate appAutoDataMessageTemplate;
|
private final AppAutoDataMessageTemplate appAutoDataMessageTemplate;
|
||||||
|
|
||||||
private final AppEventMessageTemplate appEventMessageTemplate;
|
private final AppEventMessageTemplate appEventMessageTemplate;
|
||||||
|
|
||||||
private final CsLogsFeignClient csLogsFeignClient;
|
private final CsLogsFeignClient csLogsFeignClient;
|
||||||
|
|
||||||
private final AppFileMessageTemplate appFileMessageTemplate;
|
private final AppFileMessageTemplate appFileMessageTemplate;
|
||||||
|
|
||||||
private final AppFileStreamMessageTemplate appFileStreamMessageTemplate;
|
private final AppFileStreamMessageTemplate appFileStreamMessageTemplate;
|
||||||
|
|
||||||
private final ICsDeviceOnlineLogsService onlineLogsService;
|
private final ICsDeviceOnlineLogsService onlineLogsService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private final CsSoftInfoFeignClient csSoftInfoFeignClient;
|
private final CsSoftInfoFeignClient csSoftInfoFeignClient;
|
||||||
|
|
||||||
private final CsLineFeignClient csLineFeignClient;
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
|
|
||||||
private final DevCapacityFeignClient devCapacityFeignClient;
|
private final DevCapacityFeignClient devCapacityFeignClient;
|
||||||
|
|
||||||
private final EquipmentFeignClient equipmentFeignClient;
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
Validator validator;
|
Validator validator;
|
||||||
|
|
||||||
@@ -353,6 +335,8 @@ public class MqttMessageHandler {
|
|||||||
onlineLogsService.save(csDeviceOnlineLogs);
|
onlineLogsService.save(csDeviceOnlineLogs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//接入后系统模拟装置心跳
|
||||||
|
redisUtil.saveByKeyWithExpire("MQTT:" + nDid, Instant.now().toEpochMilli(),300L);
|
||||||
//修改redis的mid
|
//修改redis的mid
|
||||||
redisUtil.saveByKey(AppRedisKey.DEVICE_MID + nDid,1);
|
redisUtil.saveByKey(AppRedisKey.DEVICE_MID + nDid,1);
|
||||||
redisUtil.saveByKeyWithExpire("online" + nDid,"online",10L);
|
redisUtil.saveByKeyWithExpire("online" + nDid,"online",10L);
|
||||||
@@ -411,27 +395,29 @@ public class MqttMessageHandler {
|
|||||||
List<CsDevCapacityPO> list = new ArrayList<>();
|
List<CsDevCapacityPO> list = new ArrayList<>();
|
||||||
devInfo.forEach(item->{
|
devInfo.forEach(item->{
|
||||||
//1.更新治理监测点信息
|
//1.更新治理监测点信息
|
||||||
if (Objects.equals(item.getClDid(),0)){
|
|
||||||
CsLineParam csLineParam = new CsLineParam();
|
CsLineParam csLineParam = new CsLineParam();
|
||||||
|
if (Objects.equals(item.getClDid(),0)){
|
||||||
csLineParam.setLineId(nDid.concat("0"));
|
csLineParam.setLineId(nDid.concat("0"));
|
||||||
csLineParam.setVolGrade(item.getVolGrade());
|
|
||||||
csLineParam.setPtRatio(item.getPtRatio());
|
|
||||||
csLineParam.setCtRatio(item.getCtRatio());
|
|
||||||
csLineParam.setConType(item.getConType());
|
|
||||||
csLineFeignClient.updateLine(csLineParam);
|
|
||||||
}
|
|
||||||
//2.录入各个模块设备容量
|
//2.录入各个模块设备容量
|
||||||
CsDevCapacityPO csDevCapacity = new CsDevCapacityPO();
|
CsDevCapacityPO csDevCapacity = new CsDevCapacityPO();
|
||||||
csDevCapacity.setLineId(nDid.concat("0"));
|
csDevCapacity.setLineId(nDid.concat("0"));
|
||||||
csDevCapacity.setCldid(item.getClDid());
|
csDevCapacity.setCldid(item.getClDid());
|
||||||
csDevCapacity.setCapacity(Objects.isNull(item.getCapacityA())?0.0:item.getCapacityA());
|
csDevCapacity.setCapacity(Objects.isNull(item.getCapacityA())?0.0:item.getCapacityA());
|
||||||
list.add(csDevCapacity);
|
list.add(csDevCapacity);
|
||||||
|
} else {
|
||||||
|
csLineParam.setLineId(nDid.concat(item.getClDid().toString()));
|
||||||
|
}
|
||||||
|
csLineParam.setVolGrade(item.getVolGrade());
|
||||||
|
csLineParam.setPtRatio(item.getPtRatio());
|
||||||
|
csLineParam.setCtRatio(item.getCtRatio());
|
||||||
|
csLineParam.setConType(item.getConType());
|
||||||
|
csLineFeignClient.updateLine(csLineParam);
|
||||||
});
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
devCapacityFeignClient.addList(list);
|
devCapacityFeignClient.addList(list);
|
||||||
//3.更新设备模块个数
|
//3.更新设备模块个数
|
||||||
equipmentFeignClient.updateModuleNumber(nDid,(devInfo.size()-1));
|
equipmentFeignClient.updateModuleNumber(nDid,(devInfo.size()-1));
|
||||||
//4.询问监测点pt/ct信息
|
}
|
||||||
//askDevData(nDid,version,3,(res.getMid()+1));
|
|
||||||
} else if (Objects.equals(res.getDid(),2)) {
|
} else if (Objects.equals(res.getDid(),2)) {
|
||||||
logDto.setOperate(nDid + "更新电网侧、负载侧监测点信息");
|
logDto.setOperate(nDid + "更新电网侧、负载侧监测点信息");
|
||||||
//1.更新电网侧、负载侧监测点相关信息
|
//1.更新电网侧、负载侧监测点相关信息
|
||||||
@@ -659,13 +645,13 @@ public class MqttMessageHandler {
|
|||||||
|
|
||||||
private void saveDirectoryInfo(List<FileDto.DirInfo> dirInfo, String key) {
|
private void saveDirectoryInfo(List<FileDto.DirInfo> dirInfo, String key) {
|
||||||
if (!CollectionUtil.isEmpty(dirInfo)) {
|
if (!CollectionUtil.isEmpty(dirInfo)) {
|
||||||
redisUtil.saveByKeyWithExpire(key, dirInfo, 10L);
|
redisUtil.saveByKeyWithExpire(key, dirInfo, 20L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveFileInfo(FileDto.FileInfo fileInfo, String key) {
|
private void saveFileInfo(FileDto.FileInfo fileInfo, String key) {
|
||||||
if (!Objects.isNull(fileInfo)) {
|
if (!Objects.isNull(fileInfo)) {
|
||||||
redisUtil.saveByKeyWithExpire(key, fileInfo, 10L);
|
redisUtil.saveByKeyWithExpire(key, fileInfo, 20L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -698,7 +684,7 @@ public class MqttMessageHandler {
|
|||||||
askDataDto.setEndTime(-1);
|
askDataDto.setEndTime(-1);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1:
|
case 1:
|
||||||
reqAndResParam.setDid(2);
|
reqAndResParam.setDid(0);
|
||||||
askDataDto.setCldid(0);
|
askDataDto.setCldid(0);
|
||||||
askDataDto.setDataType(1);
|
askDataDto.setDataType(1);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.access.listener;
|
|||||||
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
import com.njcn.access.enums.AccessEnum;
|
import com.njcn.access.enums.AccessEnum;
|
||||||
|
import com.njcn.access.pojo.po.CsDeviceOnlineLogs;
|
||||||
import com.njcn.access.service.ICsDeviceOnlineLogsService;
|
import com.njcn.access.service.ICsDeviceOnlineLogsService;
|
||||||
import com.njcn.access.service.ICsEquipmentDeliveryService;
|
import com.njcn.access.service.ICsEquipmentDeliveryService;
|
||||||
import com.njcn.access.service.ICsTopicService;
|
import com.njcn.access.service.ICsTopicService;
|
||||||
@@ -14,6 +15,7 @@ import com.njcn.csdevice.api.CsLogsFeignClient;
|
|||||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.user.api.AppUserFeignClient;
|
import com.njcn.user.api.AppUserFeignClient;
|
||||||
import com.njcn.user.api.UserFeignClient;
|
import com.njcn.user.api.UserFeignClient;
|
||||||
@@ -83,8 +85,6 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
|||||||
super(listenerContainer);
|
super(listenerContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当前尝试次数
|
|
||||||
private static int attemptCount = 1;
|
|
||||||
//最大告警次数
|
//最大告警次数
|
||||||
private static int MAX_WARNING_TIMES = 0;
|
private static int MAX_WARNING_TIMES = 0;
|
||||||
|
|
||||||
@@ -105,6 +105,17 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
|||||||
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||||
executeMainTask(scheduler,nDid,version);
|
executeMainTask(scheduler,nDid,version);
|
||||||
}
|
}
|
||||||
|
//自动接入
|
||||||
|
else if (expiredKey.startsWith("autoAccess")) {
|
||||||
|
List<CsEquipmentDeliveryPO> list = csEquipmentDeliveryService.getAll();
|
||||||
|
list.forEach(item->{
|
||||||
|
String version = csTopicService.getVersion(item.getNdid());
|
||||||
|
if (!Objects.isNull(version)){
|
||||||
|
csDeviceService.devAccessAskTemplate(item.getNdid(),version,1);
|
||||||
|
redisUtil.saveByKey(AppRedisKey.DEVICE_MID + item.getNdid(),1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//主任务
|
//主任务
|
||||||
@@ -118,9 +129,9 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
|||||||
String clientName = "NJCN-" + nDid.substring(nDid.length() - 6);
|
String clientName = "NJCN-" + nDid.substring(nDid.length() - 6);
|
||||||
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||||
//心跳异常,但是客户端在线,则发送接入请求
|
//心跳异常,但是客户端在线,则发送接入请求
|
||||||
//这边可能存在装置已经掉线,但是客户端仍然在线的情况
|
|
||||||
if (mqttClient) {
|
if (mqttClient) {
|
||||||
csDeviceService.devAccessAskTemplate(nDid,version,1);
|
csDeviceService.devAccessAskTemplate(nDid,version,1);
|
||||||
|
redisUtil.saveByKey(AppRedisKey.DEVICE_MID + nDid,1);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
Object object = redisUtil.getObjectByKey("online" + nDid);
|
Object object = redisUtil.getObjectByKey("online" + nDid);
|
||||||
@@ -132,6 +143,10 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
|||||||
csEquipmentDeliveryService.updateRunStatusBynDid(nDid, AccessEnum.OFFLINE.getCode());
|
csEquipmentDeliveryService.updateRunStatusBynDid(nDid, AccessEnum.OFFLINE.getCode());
|
||||||
startScheduledTask(scheduler,nDid,version);
|
startScheduledTask(scheduler,nDid,version);
|
||||||
logDto.setOperate("客户端离线进入定时任务");
|
logDto.setOperate("客户端离线进入定时任务");
|
||||||
|
//记录装置掉线时间
|
||||||
|
CsDeviceOnlineLogs record = onlineLogsService.findLastData(nDid);
|
||||||
|
record.setOfflineTime(LocalDateTime.now());
|
||||||
|
onlineLogsService.updateById(record);
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -159,11 +174,14 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
|||||||
//判断客户端
|
//判断客户端
|
||||||
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||||
if (mqttClient) {
|
if (mqttClient) {
|
||||||
csDeviceService.devAccessAskTemplate(nDid,version,attemptCount++);
|
csDeviceService.devAccessAskTemplate(nDid,version,1);
|
||||||
|
try {
|
||||||
|
Thread.sleep(2000);
|
||||||
Integer status = csEquipmentDeliveryService.queryEquipmentBynDid(nDid).getRunStatus();
|
Integer status = csEquipmentDeliveryService.queryEquipmentBynDid(nDid).getRunStatus();
|
||||||
if (Objects.equals(status,AccessEnum.ONLINE.getCode())){
|
if (Objects.equals(status,AccessEnum.ONLINE.getCode())){
|
||||||
logDto.setResult(1);
|
logDto.setResult(1);
|
||||||
scheduler.shutdown();
|
scheduler.shutdown();
|
||||||
|
redisUtil.saveByKey(AppRedisKey.DEVICE_MID + nDid,1);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
logDto.setResult(0);
|
logDto.setResult(0);
|
||||||
@@ -175,6 +193,9 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
|||||||
addLogs(dto2);
|
addLogs(dto2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//一个小时未连接上,则推送告警消息
|
//一个小时未连接上,则推送告警消息
|
||||||
MAX_WARNING_TIMES++;
|
MAX_WARNING_TIMES++;
|
||||||
@@ -193,7 +214,6 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
|||||||
//掉线通知
|
//掉线通知
|
||||||
private NoticeUserDto sendOffLine(String nDid) {
|
private NoticeUserDto sendOffLine(String nDid) {
|
||||||
NoticeUserDto dto = new NoticeUserDto();
|
NoticeUserDto dto = new NoticeUserDto();
|
||||||
// NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
|
||||||
dto.setTitle("设备离线");
|
dto.setTitle("设备离线");
|
||||||
CsEquipmentDeliveryPO po = equipmentFeignClient.findDevByNDid(nDid).getData();
|
CsEquipmentDeliveryPO po = equipmentFeignClient.findDevByNDid(nDid).getData();
|
||||||
DevDetailDTO devDetailDto = csLedgerFeignclient.queryDevDetail(po.getId()).getData();
|
DevDetailDTO devDetailDto = csLedgerFeignclient.queryDevDetail(po.getId()).getData();
|
||||||
@@ -203,16 +223,12 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
|||||||
String content = String.format(devDetailDto.getEngineeringName() + "-" + devDetailDto.getProjectName() + "-" + devDetailDto.getEquipmentName() + "于" + dateStr + "离线");
|
String content = String.format(devDetailDto.getEngineeringName() + "-" + devDetailDto.getProjectName() + "-" + devDetailDto.getEquipmentName() + "于" + dateStr + "离线");
|
||||||
dto.setContent(content);
|
dto.setContent(content);
|
||||||
dto.setPushClientId(getEventUser(po.getId(),true));
|
dto.setPushClientId(getEventUser(po.getId(),true));
|
||||||
// payload.setType(3);
|
|
||||||
// payload.setPath("/pages/message/message?type="+payload.getType());
|
|
||||||
// dto.setPayload(payload);
|
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
//重连失败通知
|
//重连失败通知
|
||||||
private NoticeUserDto sendConnectFail(String nDid) {
|
private NoticeUserDto sendConnectFail(String nDid) {
|
||||||
NoticeUserDto dto = new NoticeUserDto();
|
NoticeUserDto dto = new NoticeUserDto();
|
||||||
// NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
|
||||||
dto.setTitle("设备接入失败");
|
dto.setTitle("设备接入失败");
|
||||||
CsEquipmentDeliveryPO po = equipmentFeignClient.findDevByNDid(nDid).getData();
|
CsEquipmentDeliveryPO po = equipmentFeignClient.findDevByNDid(nDid).getData();
|
||||||
DevDetailDTO devDetailDto = csLedgerFeignclient.queryDevDetail(po.getId()).getData();
|
DevDetailDTO devDetailDto = csLedgerFeignclient.queryDevDetail(po.getId()).getData();
|
||||||
@@ -222,9 +238,6 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
|||||||
String content = String.format(devDetailDto.getEngineeringName() + "-" + devDetailDto.getProjectName() + "-" + devDetailDto.getEquipmentName() + "于" + dateStr + "多次接入失败");
|
String content = String.format(devDetailDto.getEngineeringName() + "-" + devDetailDto.getProjectName() + "-" + devDetailDto.getEquipmentName() + "于" + dateStr + "多次接入失败");
|
||||||
dto.setContent(content);
|
dto.setContent(content);
|
||||||
dto.setPushClientId(getEventUser(po.getId(),false));
|
dto.setPushClientId(getEventUser(po.getId(),false));
|
||||||
// payload.setType(3);
|
|
||||||
// payload.setPath("/pages/message/message?type="+payload.getType());
|
|
||||||
// dto.setPayload(payload);
|
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,6 +300,4 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
|||||||
e.getMessage();
|
e.getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,12 @@
|
|||||||
package com.njcn.access.runner;
|
package com.njcn.access.runner;
|
||||||
|
|
||||||
import com.njcn.access.service.ICsEquipmentDeliveryService;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.access.service.ICsTopicService;
|
|
||||||
import com.njcn.access.service.impl.CsDeviceServiceImpl;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类的介绍:用来重新发起设备的接入,存在程序意外停止了,缓存失效导致无法更新装置的状态,所以需要在程序启动时发起设备的接入
|
* 类的介绍:用来重新发起设备的接入,存在程序意外停止了,缓存失效导致无法更新装置的状态,所以需要在程序启动时发起设备的接入
|
||||||
@@ -25,21 +20,11 @@ import java.util.Objects;
|
|||||||
public class AccessApplicationRunner implements ApplicationRunner {
|
public class AccessApplicationRunner implements ApplicationRunner {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CsDeviceServiceImpl csDeviceService;
|
private RedisUtil redisUtil;
|
||||||
@Resource
|
|
||||||
private ICsTopicService csTopicService;
|
|
||||||
@Resource
|
|
||||||
private ICsEquipmentDeliveryService csEquipmentDeliveryService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args){
|
public void run(ApplicationArguments args) {
|
||||||
List<CsEquipmentDeliveryPO> list = csEquipmentDeliveryService.getAll();
|
redisUtil.saveByKeyWithExpire("autoAccess",null,60L);
|
||||||
list.forEach(item->{
|
|
||||||
String version = csTopicService.getVersion(item.getNdid());
|
|
||||||
if (!Objects.isNull(version)){
|
|
||||||
csDeviceService.devAccessAskTemplate(item.getNdid(),version,1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,11 @@ import com.njcn.access.pojo.dto.ControlDto;
|
|||||||
import com.njcn.access.pojo.dto.ReqAndResDto;
|
import com.njcn.access.pojo.dto.ReqAndResDto;
|
||||||
import com.njcn.access.pojo.dto.file.FileRedisDto;
|
import com.njcn.access.pojo.dto.file.FileRedisDto;
|
||||||
import com.njcn.access.service.AskDeviceDataService;
|
import com.njcn.access.service.AskDeviceDataService;
|
||||||
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.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.zlevent.pojo.dto.FileStreamDto;
|
import com.njcn.zlevent.pojo.dto.FileStreamDto;
|
||||||
import com.njcn.zlevent.pojo.dto.NoticeUserDto;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -25,11 +23,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.concurrent.ScheduledFuture;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
@@ -113,7 +106,7 @@ public class AskDeviceDataServiceImpl implements AskDeviceDataService {
|
|||||||
Object object3 = redisUtil.getObjectByKey(AppRedisKey.FILE_PART.concat(name));
|
Object object3 = redisUtil.getObjectByKey(AppRedisKey.FILE_PART.concat(name));
|
||||||
if (!Objects.isNull(object3)) {
|
if (!Objects.isNull(object3)) {
|
||||||
FileStreamDto dto = JSON.parseObject(JSON.toJSONString(object3), FileStreamDto.class);
|
FileStreamDto dto = JSON.parseObject(JSON.toJSONString(object3), FileStreamDto.class);
|
||||||
String json = "{allStep:"+dto.getTotal()+",nowStep:"+ (CollectionUtil.isEmpty(dto.getList())?0:dto.getList().size())+"}";
|
String json = "{fileName:"+name+",allStep:"+dto.getTotal()+",nowStep:"+ (CollectionUtil.isEmpty(dto.getList())?0:dto.getList().size())+"}";
|
||||||
publisher.send("/Web/Progress/" + nDid, new Gson().toJson(json), 1, false);
|
publisher.send("/Web/Progress/" + nDid, new Gson().toJson(json), 1, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import com.njcn.system.pojo.vo.DictTreeVO;
|
|||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -64,49 +65,26 @@ import java.util.stream.Collectors;
|
|||||||
public class CsDevModelServiceImpl implements ICsDevModelService {
|
public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
private final DevModelFeignClient devModelFeignClient;
|
private final DevModelFeignClient devModelFeignClient;
|
||||||
|
|
||||||
private final EpdFeignClient epdFeignClient;
|
private final EpdFeignClient epdFeignClient;
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
private final EleEvtFeignClient eleEvtFeignClient;
|
private final EleEvtFeignClient eleEvtFeignClient;
|
||||||
|
|
||||||
private final ICsDataSetService csDataSetService;
|
private final ICsDataSetService csDataSetService;
|
||||||
|
|
||||||
private final ICsDataArrayService csDataArrayService;
|
private final ICsDataArrayService csDataArrayService;
|
||||||
|
|
||||||
private final CsDevModelMapper csDevModelMapper;
|
private final CsDevModelMapper csDevModelMapper;
|
||||||
|
|
||||||
private final ICsLineModelService csLineModelService;
|
private final ICsLineModelService csLineModelService;
|
||||||
|
|
||||||
private final ICsGroupService csGroupService;
|
private final ICsGroupService csGroupService;
|
||||||
|
|
||||||
private final ICsGroArrService csGroArrService;
|
private final ICsGroArrService csGroArrService;
|
||||||
|
|
||||||
private final CsLogsFeignClient csLogsFeignClient;
|
private final CsLogsFeignClient csLogsFeignClient;
|
||||||
|
|
||||||
private final EleWaveFeignClient waveFeignClient;
|
private final EleWaveFeignClient waveFeignClient;
|
||||||
|
|
||||||
private final DictTreeFeignClient dictTreeFeignClient;
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
private final MqttPublisher publisher;
|
private final MqttPublisher publisher;
|
||||||
|
|
||||||
private final ICsTopicService csTopicService;
|
private final ICsTopicService csTopicService;
|
||||||
|
|
||||||
private final ICsEquipmentDeliveryService csEquipmentDeliveryService;
|
|
||||||
|
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
|
|
||||||
private final MqttMessageHandler mqttMessageHandler;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshDevModelCache() {
|
public void refreshDevModelCache() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -191,7 +169,7 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
|||||||
int times = bytes.length / cap + 1;
|
int times = bytes.length / cap + 1;
|
||||||
for (int i = 1; i <= times; i++) {
|
for (int i = 1; i <= times; i++) {
|
||||||
//发送数据给前端
|
//发送数据给前端
|
||||||
String json = "{allStep:"+times+",nowStep:"+i+"}";
|
String json = "{fileName:"+file.getOriginalFilename()+",allStep:"+times+",nowStep:"+i+"}";
|
||||||
publisher.send("/Web/Progress/" + id, new Gson().toJson(json), 1, false);
|
publisher.send("/Web/Progress/" + id, new Gson().toJson(json), 1, false);
|
||||||
DeviceLogDTO logDto = new DeviceLogDTO();
|
DeviceLogDTO logDto = new DeviceLogDTO();
|
||||||
byte[] lsBytes;
|
byte[] lsBytes;
|
||||||
@@ -222,7 +200,7 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
|||||||
csLogsFeignClient.addUserLog(logDto);
|
csLogsFeignClient.addUserLog(logDto);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String json = "{allStep:\""+1+"\",nowStep:"+1+"}";
|
String json = "{fileName:"+file.getOriginalFilename()+",allStep:\""+1+"\",nowStep:"+1+"}";
|
||||||
publisher.send("/Web/Progress", new Gson().toJson(json), 1, false);
|
publisher.send("/Web/Progress", new Gson().toJson(json), 1, false);
|
||||||
ReqAndResDto.Req req = getPojo(1,path,file,length,bytes,0,hexString);
|
ReqAndResDto.Req req = getPojo(1,path,file,length,bytes,0,hexString);
|
||||||
publisher.send("/Pfm/DevFileCmd/" + version + "/" + id, new Gson().toJson(req), 1, false);
|
publisher.send("/Pfm/DevFileCmd/" + version + "/" + id, new Gson().toJson(req), 1, false);
|
||||||
@@ -1243,14 +1221,14 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
|||||||
if (Objects.equals(code, DicDataEnum.CONNECT_DEV.getCode()) || Objects.isNull(code)){
|
if (Objects.equals(code, DicDataEnum.CONNECT_DEV.getCode()) || Objects.isNull(code)){
|
||||||
showName = "电网侧数据";
|
showName = "电网侧数据";
|
||||||
} else if (Objects.equals(code, DicDataEnum.PORTABLE.getCode())){
|
} else if (Objects.equals(code, DicDataEnum.PORTABLE.getCode())){
|
||||||
showName = "监测1路数据";
|
showName = "监测1#数据";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "Ds$Pqd$Stat$02":
|
case "Ds$Pqd$Stat$02":
|
||||||
if (Objects.equals(code, DicDataEnum.CONNECT_DEV.getCode()) || Objects.isNull(code)){
|
if (Objects.equals(code, DicDataEnum.CONNECT_DEV.getCode()) || Objects.isNull(code)){
|
||||||
showName = "负载侧数据";
|
showName = "负载侧数据";
|
||||||
} else if (Objects.equals(code, DicDataEnum.PORTABLE.getCode())){
|
} else if (Objects.equals(code, DicDataEnum.PORTABLE.getCode())){
|
||||||
showName = "监测2路数据";
|
showName = "监测2#数据";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//波形参数名称
|
//波形参数名称
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.njcn.access.service.impl;
|
|||||||
|
|
||||||
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.util.IdUtil;
|
|
||||||
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -11,7 +10,6 @@ import com.njcn.access.enums.AccessEnum;
|
|||||||
import com.njcn.access.enums.AccessResponseEnum;
|
import com.njcn.access.enums.AccessResponseEnum;
|
||||||
import com.njcn.access.enums.TypeEnum;
|
import com.njcn.access.enums.TypeEnum;
|
||||||
import com.njcn.access.param.DevAccessParam;
|
import com.njcn.access.param.DevAccessParam;
|
||||||
import com.njcn.access.pojo.RspDataDto;
|
|
||||||
import com.njcn.access.pojo.dto.AccessDto;
|
import com.njcn.access.pojo.dto.AccessDto;
|
||||||
import com.njcn.access.pojo.dto.CsModelDto;
|
import com.njcn.access.pojo.dto.CsModelDto;
|
||||||
import com.njcn.access.pojo.dto.ReqAndResDto;
|
import com.njcn.access.pojo.dto.ReqAndResDto;
|
||||||
@@ -37,7 +35,6 @@ import com.njcn.system.enums.DicDataEnum;
|
|||||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import net.sf.cglib.core.Local;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -225,16 +222,34 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
po.setClDid(0);
|
po.setClDid(0);
|
||||||
if (Objects.equals(DicDataEnum.GRID_SIDE.getCode(),location)){
|
if (Objects.equals(DicDataEnum.GRID_SIDE.getCode(),location)){
|
||||||
po.setLineId(devAccessParam.getNDid() + "1");
|
po.setLineId(devAccessParam.getNDid() + "1");
|
||||||
|
String id = Objects.requireNonNull(modelId.stream().filter(it -> Objects.equals(it.getDid(), 2)).findFirst().orElse(null)).getModelId();
|
||||||
|
po.setDataModelId(id);
|
||||||
|
//获取模板下数据集
|
||||||
|
List<CsDataSet> dataSets = csDataSetService.getDataSetData(id);
|
||||||
|
String dataSetId = Objects.requireNonNull(dataSets.stream().filter(it -> Objects.equals(it.getClDev(), 1)&&Objects.equals(it.getType(), 2)).findFirst().orElse(null)).getId();
|
||||||
|
po.setDataSetId(dataSetId);
|
||||||
param.setId(devAccessParam.getNDid() + "1");
|
param.setId(devAccessParam.getNDid() + "1");
|
||||||
appLineTopologyDiagramPo.setLineId(devAccessParam.getNDid() + "1");
|
appLineTopologyDiagramPo.setLineId(devAccessParam.getNDid() + "1");
|
||||||
po.setClDid(1);
|
po.setClDid(1);
|
||||||
} else if (Objects.equals(DicDataEnum.LOAD_SIDE.getCode(),location)){
|
} else if (Objects.equals(DicDataEnum.LOAD_SIDE.getCode(),location)){
|
||||||
po.setLineId(devAccessParam.getNDid() + "2");
|
po.setLineId(devAccessParam.getNDid() + "2");
|
||||||
|
String id = Objects.requireNonNull(modelId.stream().filter(it -> Objects.equals(it.getDid(), 2)).findFirst().orElse(null)).getModelId();
|
||||||
|
po.setDataModelId(id);
|
||||||
|
//获取模板下数据集
|
||||||
|
List<CsDataSet> dataSets = csDataSetService.getDataSetData(id);
|
||||||
|
String dataSetId = Objects.requireNonNull(dataSets.stream().filter(it -> Objects.equals(it.getClDev(), 2)&&Objects.equals(it.getType(), 2)).findFirst().orElse(null)).getId();
|
||||||
|
po.setDataSetId(dataSetId);
|
||||||
param.setId(devAccessParam.getNDid() + "2");
|
param.setId(devAccessParam.getNDid() + "2");
|
||||||
appLineTopologyDiagramPo.setLineId(devAccessParam.getNDid() + "2");
|
appLineTopologyDiagramPo.setLineId(devAccessParam.getNDid() + "2");
|
||||||
po.setClDid(2);
|
po.setClDid(2);
|
||||||
} else {
|
} else {
|
||||||
po.setLineId(devAccessParam.getNDid() + "0");
|
po.setLineId(devAccessParam.getNDid() + "0");
|
||||||
|
String id = Objects.requireNonNull(modelId.stream().filter(it -> Objects.equals(it.getDid(), 1)).findFirst().orElse(null)).getModelId();
|
||||||
|
po.setDataModelId(id);
|
||||||
|
//获取模板下数据集
|
||||||
|
List<CsDataSet> dataSets = csDataSetService.getDataSetData(id);
|
||||||
|
String dataSetId = Objects.requireNonNull(dataSets.stream().filter(it -> Objects.equals(it.getClDev(), 0)&&Objects.equals(it.getType(), 0)).findFirst().orElse(null)).getId();
|
||||||
|
po.setDataSetId(dataSetId);
|
||||||
param.setId(devAccessParam.getNDid() + "0");
|
param.setId(devAccessParam.getNDid() + "0");
|
||||||
appLineTopologyDiagramPo.setLineId(devAccessParam.getNDid() + "0");
|
appLineTopologyDiagramPo.setLineId(devAccessParam.getNDid() + "0");
|
||||||
}
|
}
|
||||||
@@ -364,7 +379,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
DeviceLogDTO logDto = new DeviceLogDTO();
|
DeviceLogDTO logDto = new DeviceLogDTO();
|
||||||
logDto.setUserName(RequestUtil.getUserNickname());
|
logDto.setUserName(RequestUtil.getUserNickname());
|
||||||
logDto.setLoginName(RequestUtil.getUsername());
|
logDto.setLoginName(RequestUtil.getUsername());
|
||||||
logDto.setOperate("设备"+nDid+"注册");
|
logDto.setOperate("便携式设备"+nDid+"注册、接入");
|
||||||
logDto.setResult(1);
|
logDto.setResult(1);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
@@ -372,7 +387,15 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
String version = csTopicService.getVersion(nDid);
|
String version = csTopicService.getVersion(nDid);
|
||||||
CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(nDid).getData();
|
CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(nDid).getData();
|
||||||
List<CsLinePO> csLinePoList = new ArrayList<>();
|
List<CsLinePO> csLinePoList = new ArrayList<>();
|
||||||
//1.根据模板获取监测点个数,插入监测点表
|
//1.录入装置台账信息
|
||||||
|
CsLedgerParam csLedgerParam = new CsLedgerParam();
|
||||||
|
csLedgerParam.setId(vo.getId());
|
||||||
|
csLedgerParam.setPid("0");
|
||||||
|
csLedgerParam.setName(vo.getName());
|
||||||
|
csLedgerParam.setLevel(2);
|
||||||
|
csLedgerParam.setSort(0);
|
||||||
|
csLedgerService.addLedgerTree(csLedgerParam);
|
||||||
|
//2.根据模板获取监测点个数,插入监测点表
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
List<CsModelDto> modelList = channelObjectUtil.objectToList(redisUtil.getObjectByKey(AppRedisKey.MODEL + nDid),CsModelDto.class);
|
List<CsModelDto> modelList = channelObjectUtil.objectToList(redisUtil.getObjectByKey(AppRedisKey.MODEL + nDid),CsModelDto.class);
|
||||||
if (CollUtil.isEmpty(modelList)){
|
if (CollUtil.isEmpty(modelList)){
|
||||||
@@ -386,31 +409,37 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
CsLinePO po = new CsLinePO();
|
CsLinePO po = new CsLinePO();
|
||||||
po.setLineId(nDid + item.getClDev().toString());
|
po.setLineId(nDid + item.getClDev().toString());
|
||||||
po.setName(item.getClDev().toString() + "号监测点");
|
po.setName(item.getClDev().toString() + "#监测点");
|
||||||
po.setStatus(1);
|
po.setStatus(1);
|
||||||
po.setClDid(item.getClDev());
|
po.setClDid(item.getClDev());
|
||||||
po.setDeviceId(vo.getId());
|
po.setDeviceId(vo.getId());
|
||||||
//防止主键重复
|
//防止主键重复
|
||||||
QueryWrapper<CsLinePO> qw = new QueryWrapper();
|
QueryWrapper<CsLinePO> qw = new QueryWrapper<>();
|
||||||
qw.eq("line_id",po.getLineId());
|
qw.eq("line_id",po.getLineId());
|
||||||
if(csLineService.getBaseMapper().selectList(qw).isEmpty()){
|
if(csLineService.getBaseMapper().selectList(qw).isEmpty()){
|
||||||
csLinePoList.add(po);
|
csLinePoList.add(po);
|
||||||
}
|
}
|
||||||
|
//3.生成台账树监测点数据
|
||||||
|
CsLedgerParam param = new CsLedgerParam();
|
||||||
|
param.setId(nDid + item.getClDev().toString());
|
||||||
|
param.setPid(vo.getId());
|
||||||
|
param.setName(item.getClDev().toString() + "#监测点");
|
||||||
|
param.setLevel(3);
|
||||||
|
param.setSort(0);
|
||||||
|
csLedgerService.addLedgerTree(param);
|
||||||
});
|
});
|
||||||
csLineService.saveBatch(csLinePoList);
|
csLineService.saveBatch(csLinePoList);
|
||||||
//2.生成装置和模板的关系表
|
//4.生成装置和模板的关系表
|
||||||
CsDevModelRelationAddParm csDevModelRelationAddParm = new CsDevModelRelationAddParm();
|
CsDevModelRelationAddParm csDevModelRelationAddParm = new CsDevModelRelationAddParm();
|
||||||
csDevModelRelationAddParm.setDevId(vo.getId());
|
csDevModelRelationAddParm.setDevId(vo.getId());
|
||||||
csDevModelRelationAddParm.setModelId(modelList.get(0).getModelId());
|
csDevModelRelationAddParm.setModelId(modelList.get(0).getModelId());
|
||||||
csDevModelRelationAddParm.setDid(modelList.get(0).getDid());
|
csDevModelRelationAddParm.setDid(modelList.get(0).getDid());
|
||||||
csDevModelRelationService.addDevModelRelation(csDevModelRelationAddParm);
|
csDevModelRelationService.addDevModelRelation(csDevModelRelationAddParm);
|
||||||
//3.修改装置状态为注册状态
|
//5.发起自动接入请求
|
||||||
csEquipmentDeliveryService.updateStatusBynDid(nDid, AccessEnum.REGISTERED.getCode());
|
|
||||||
//4.发起自动接入请求
|
|
||||||
devAccessAskTemplate(nDid,version,1);
|
devAccessAskTemplate(nDid,version,1);
|
||||||
//5.存储日志
|
//6.存储日志
|
||||||
csLogsFeignClient.addUserLog(logDto);
|
csLogsFeignClient.addUserLog(logDto);
|
||||||
//6.存储设备调试日志表
|
//7.存储设备调试日志表
|
||||||
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
|
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
|
||||||
csEquipmentProcess.setDevId(nDid);
|
csEquipmentProcess.setDevId(nDid);
|
||||||
csEquipmentProcess.setOperator(RequestUtil.getUserIndex());
|
csEquipmentProcess.setOperator(RequestUtil.getUserIndex());
|
||||||
@@ -419,7 +448,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
csEquipmentProcess.setProcess(4);
|
csEquipmentProcess.setProcess(4);
|
||||||
csEquipmentProcess.setStatus(1);
|
csEquipmentProcess.setStatus(1);
|
||||||
processFeignClient.add(csEquipmentProcess);
|
processFeignClient.add(csEquipmentProcess);
|
||||||
//7.删除redis监测点模板信息
|
//8.删除redis监测点模板信息
|
||||||
redisUtil.delete(AppRedisKey.MODEL + nDid);
|
redisUtil.delete(AppRedisKey.MODEL + nDid);
|
||||||
redisUtil.delete(AppRedisKey.LINE + nDid);
|
redisUtil.delete(AppRedisKey.LINE + nDid);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -527,6 +556,8 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
po.setUpdateTime(LocalDateTime.now());
|
po.setUpdateTime(LocalDateTime.now());
|
||||||
csDevModelRelationService.addRelation(po);
|
csDevModelRelationService.addRelation(po);
|
||||||
}
|
}
|
||||||
|
//fixme 修改监测点使用的模板和数据集
|
||||||
|
|
||||||
//发起接入
|
//发起接入
|
||||||
reqAndResParam.setType(Integer.parseInt(TypeEnum.TYPE_5.getCode()));
|
reqAndResParam.setType(Integer.parseInt(TypeEnum.TYPE_5.getCode()));
|
||||||
publisher.send("/Pfm/DevCmd/"+version+"/"+nDid, new Gson().toJson(reqAndResParam),1,false);
|
publisher.send("/Pfm/DevCmd/"+version+"/"+nDid, new Gson().toJson(reqAndResParam),1,false);
|
||||||
|
|||||||
@@ -32,9 +32,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
if (Objects.equals(csLedgerParam.getPid(),"9999999")){
|
if (Objects.equals(csLedgerParam.getPid(),"9999999")){
|
||||||
csLedger.setPid("0");
|
csLedger.setPid("0");
|
||||||
csLedger.setPids("0");
|
csLedger.setPids("0");
|
||||||
|
} else {
|
||||||
|
if (Objects.isNull(fatherCsLedger)) {
|
||||||
|
csLedger.setPids("0");
|
||||||
} else {
|
} else {
|
||||||
csLedger.setPids(fatherCsLedger.getPids() + "," + csLedgerParam.getPid());
|
csLedger.setPids(fatherCsLedger.getPids() + "," + csLedgerParam.getPid());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.save(csLedger);
|
this.save(csLedger);
|
||||||
return csLedger;
|
return csLedger;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
//package com.njcn.stat.api;
|
|
||||||
//
|
|
||||||
//import com.njcn.common.pojo.constant.ServerInfo;
|
|
||||||
//import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
//import com.njcn.mq.message.AppAutoDataMessage;
|
|
||||||
//import com.njcn.stat.api.fallback.WlRecordClientFallbackFactory;
|
|
||||||
//import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
//import org.springframework.validation.annotation.Validated;
|
|
||||||
//import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
//import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * @author xy
|
|
||||||
// */
|
|
||||||
//@FeignClient(value = ServerInfo.CS_STAT_BOOT, path = "/record", fallbackFactory = WlRecordClientFallbackFactory.class,contextId = "record")
|
|
||||||
//public interface WlRecordFeignClient {
|
|
||||||
//
|
|
||||||
// @PostMapping("/addOrUpdateBaseData")
|
|
||||||
// HttpResult<String> addOrUpdateBaseData(@RequestBody @Validated AppAutoDataMessage appAutoDataMessage);
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
//package com.njcn.stat.api.fallback;
|
|
||||||
//
|
|
||||||
//import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
//import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
//import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
//import com.njcn.mq.message.AppAutoDataMessage;
|
|
||||||
//import com.njcn.stat.api.WlRecordFeignClient;
|
|
||||||
//import feign.hystrix.FallbackFactory;
|
|
||||||
//import lombok.extern.slf4j.Slf4j;
|
|
||||||
//import org.springframework.stereotype.Component;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * @author xy
|
|
||||||
// */
|
|
||||||
//@Slf4j
|
|
||||||
//@Component
|
|
||||||
//public class WlRecordClientFallbackFactory implements FallbackFactory<WlRecordFeignClient> {
|
|
||||||
// @Override
|
|
||||||
// public WlRecordFeignClient create(Throwable cause) {
|
|
||||||
// //判断抛出异常是否为解码器抛出的业务异常
|
|
||||||
// Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
|
||||||
// if (cause.getCause() instanceof BusinessException) {
|
|
||||||
// BusinessException businessException = (BusinessException) cause.getCause();
|
|
||||||
// }
|
|
||||||
// Enum<?> finalExceptionEnum = exceptionEnum;
|
|
||||||
// return new WlRecordFeignClient() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public HttpResult<String> addOrUpdateBaseData(AppAutoDataMessage appAutoDataMessage) {
|
|
||||||
// log.error("{}异常,降级处理,异常为:{}","新增或更新装置基础数据",cause.toString());
|
|
||||||
// throw new BusinessException(finalExceptionEnum);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
@@ -6,6 +6,7 @@ import com.njcn.mq.message.AppEventMessage;
|
|||||||
import com.njcn.zlevent.api.fallback.EventClientFallbackFactory;
|
import com.njcn.zlevent.api.fallback.EventClientFallbackFactory;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
@@ -16,7 +17,7 @@ public interface EventFeignClient {
|
|||||||
@PostMapping("/analysis")
|
@PostMapping("/analysis")
|
||||||
HttpResult<String> analysis(AppEventMessage appEventMessage);
|
HttpResult<String> analysis(AppEventMessage appEventMessage);
|
||||||
|
|
||||||
@PostMapping("/errorEvent")
|
@PostMapping("/portableData")
|
||||||
HttpResult<String> insertErrorEvent(AppEventMessage appEventMessage);
|
HttpResult<String> getPortableData(@RequestBody AppEventMessage appEventMessage);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,11 @@ public class EventClientFallbackFactory implements FallbackFactory<EventFeignCli
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<String> insertErrorEvent(AppEventMessage appEventMessage) {
|
public HttpResult<String> getPortableData(AppEventMessage appEventMessage) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","异常事件统计",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","便携式设备数据记录动作",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/event")
|
@RequestMapping("/event")
|
||||||
@Api(tags = "暂态事件处理")
|
@Api(tags = "事件处理")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class EventController extends BaseController {
|
public class EventController extends BaseController {
|
||||||
|
|
||||||
@@ -44,4 +44,14 @@ public class EventController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/portableData")
|
||||||
|
@ApiOperation("便携式数据事件")
|
||||||
|
@ApiImplicitParam(name = "appEventMessage", value = "数据实体", required = true)
|
||||||
|
public HttpResult<String> getPortableData(@RequestBody AppEventMessage appEventMessage){
|
||||||
|
String methodDescribe = getMethodDescribe("getPortableData");
|
||||||
|
eventService.getPortableData(appEventMessage);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,12 @@ public interface IEventService {
|
|||||||
*/
|
*/
|
||||||
void analysis(AppEventMessage appEventMessage);
|
void analysis(AppEventMessage appEventMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 便携式设备基础数据
|
||||||
|
* 1.装置发起数据记录开始动作,库中新增数据;
|
||||||
|
* 2.装置发起数据记录结束动作,库中更新数据;
|
||||||
|
* @param appEventMessage
|
||||||
|
*/
|
||||||
|
void getPortableData(AppEventMessage appEventMessage);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,12 @@ import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.api.WlRecordFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
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.po.WlRecord;
|
||||||
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||||
import com.njcn.influx.utils.InfluxDbUtils;
|
import com.njcn.influx.utils.InfluxDbUtils;
|
||||||
@@ -31,11 +35,15 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.influxdb.InfluxDB;
|
import org.influxdb.InfluxDB;
|
||||||
import org.influxdb.dto.BatchPoints;
|
import org.influxdb.dto.BatchPoints;
|
||||||
import org.influxdb.dto.Point;
|
import org.influxdb.dto.Point;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
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;
|
||||||
@@ -53,22 +61,15 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class EventServiceImpl implements IEventService {
|
public class EventServiceImpl implements IEventService {
|
||||||
|
|
||||||
private final CsLineFeignClient csLineFeignClient;
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
private final EpdFeignClient epdFeignClient;
|
private final EpdFeignClient epdFeignClient;
|
||||||
|
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
|
|
||||||
private final ICsEventService csEventService;
|
private final ICsEventService csEventService;
|
||||||
|
|
||||||
private final EquipmentFeignClient equipmentFeignClient;
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
private final InfluxDbUtils influxDbUtils;
|
private final InfluxDbUtils influxDbUtils;
|
||||||
|
|
||||||
private final ICsEventLogsService csEventLogsService;
|
private final ICsEventLogsService csEventLogsService;
|
||||||
|
|
||||||
private final SendEventUtils sendEventUtils;
|
private final SendEventUtils sendEventUtils;
|
||||||
|
private final WlRecordFeignClient wlRecordFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -188,6 +189,93 @@ public class EventServiceImpl implements IEventService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void getPortableData(AppEventMessage appEventMessage) {
|
||||||
|
CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(appEventMessage.getId()).getData();
|
||||||
|
//根据报文判断是新增还是更新
|
||||||
|
List<AppEventMessage.DataArray> dataArrays = appEventMessage.getMsg().getDataArray();
|
||||||
|
dataArrays.forEach(item->{
|
||||||
|
WlRecordParam.Record param = new WlRecordParam.Record();
|
||||||
|
param.setDevId(vo.getId());
|
||||||
|
param.setLineId(appEventMessage.getId() + item.getClDid().toString());
|
||||||
|
param.setProName(item.getPrjName());
|
||||||
|
param.setProStartTime(timestampToDatetime((item.getPrjTimeStart() - 8*3600)));
|
||||||
|
WlRecord record = wlRecordFeignClient.findDevBaseData(param).getData();
|
||||||
|
if (!Objects.isNull(record)) {
|
||||||
|
if (!Objects.equals(item.getPrjTimeEnd(),-1L)) {
|
||||||
|
WlRecordParam.UpdateRecord wlRecord = new WlRecordParam.UpdateRecord();
|
||||||
|
wlRecord.setId(record.getId());
|
||||||
|
wlRecord.setProEndTime(timestampToDatetime((item.getPrjTimeEnd() - 8*3600)));
|
||||||
|
wlRecordFeignClient.updateTestRecord(wlRecord);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//新项目入库
|
||||||
|
WlRecord wlRecord = new WlRecord();
|
||||||
|
wlRecord.setId(IdUtil.simpleUUID());
|
||||||
|
wlRecord.setItemName("基础数据");
|
||||||
|
wlRecord.setGcName(item.getPrjName());
|
||||||
|
wlRecord.setDevId(vo.getId());
|
||||||
|
wlRecord.setLineId(appEventMessage.getId() + item.getClDid().toString());
|
||||||
|
wlRecord.setStatisticalInterval(item.getStatCycle());
|
||||||
|
wlRecord.setPt(item.getPtRatio());
|
||||||
|
wlRecord.setCt(item.getCtRatio());
|
||||||
|
//电压等级
|
||||||
|
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(channelVol(item.getVolGrade()) + "kV","Dev_Voltage_Stand").getData();
|
||||||
|
wlRecord.setVoltageLevel(Objects.isNull(dictData)?null:dictData.getId());
|
||||||
|
wlRecord.setCapacitySscb(item.getCapacitySscb());
|
||||||
|
wlRecord.setCapacitySscmin(item.getCapacitySscmin());
|
||||||
|
wlRecord.setCapacitySt(item.getCapacitySt());
|
||||||
|
wlRecord.setCapacitySi(item.getCapacitySi());
|
||||||
|
//电压接线方式
|
||||||
|
wlRecord.setVolConType(getVolConType(item.getVolConType()));
|
||||||
|
//fixme 电流接线方式 这边系统没有字典,录入字典通用性不强,采用装置上送值存储
|
||||||
|
wlRecord.setCurConSel(item.getCurConSel().toString());
|
||||||
|
wlRecord.setStartTime(timestampToDatetime((item.getPrjTimeStart() - 8*3600)));
|
||||||
|
wlRecord.setType(1);
|
||||||
|
wlRecord.setState(1);
|
||||||
|
wlRecord.setGcDataPath(item.getPrjDataPath());
|
||||||
|
wlRecordFeignClient.addBaseData(wlRecord);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理电压
|
||||||
|
* @param vol
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String channelVol(Float vol) {
|
||||||
|
BigDecimal value = new BigDecimal(vol);
|
||||||
|
BigDecimal noZeros = value.stripTrailingZeros();
|
||||||
|
return noZeros.toPlainString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0-星型, 1-角型, 2-V型
|
||||||
|
// star-星型、Star_Triangle-星三角、Open_Delta-开口三角
|
||||||
|
public String getVolConType(Integer volConType) {
|
||||||
|
String result = null;
|
||||||
|
String dictDataCode = null;
|
||||||
|
switch (volConType) {
|
||||||
|
case 0:
|
||||||
|
dictDataCode = "star";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
dictDataCode = "Star_Triangle";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
dictDataCode = "Open_Delta";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!Objects.isNull(dictDataCode)) {
|
||||||
|
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(dictDataCode,"Dev_Connect").getData();
|
||||||
|
result = dictData.getId();
|
||||||
|
}
|
||||||
|
return Objects.isNull(result)?null:result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存监测点相关信息
|
* 缓存监测点相关信息
|
||||||
*/
|
*/
|
||||||
@@ -248,4 +336,9 @@ public class EventServiceImpl implements IEventService {
|
|||||||
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
|
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
|
||||||
return LocalDateTime.parse(time, fmt);
|
return LocalDateTime.parse(time, fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LocalDateTime timestampToDatetime(long timestamp){
|
||||||
|
Instant instant = Instant.ofEpochSecond(timestamp);
|
||||||
|
return LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public class AppEventConsumer extends EnhanceConsumerMessageHandler<AppEventMess
|
|||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
log.info("分发至便携式基础数据处理");
|
log.info("分发至便携式基础数据处理");
|
||||||
|
eventFeignClient.getPortableData(appEventMessage);
|
||||||
break;
|
break;
|
||||||
case 241:
|
case 241:
|
||||||
log.info("分发装置异常事件统计");
|
log.info("分发装置异常事件统计");
|
||||||
|
|||||||
Reference in New Issue
Block a user