调整
All checks were successful
local-test分支构建docker并发布运行 / Docker-Build (push) Successful in 1m15s

This commit is contained in:
tiger_zhou 2024-10-24 14:24:51 +08:00
parent 69eed1fc96
commit fa1a3c9f51
2 changed files with 28 additions and 8 deletions

View File

@ -10,7 +10,11 @@ import club.joylink.xiannccda.event.Listener;
import club.joylink.xiannccda.repository.IAlertRecordRepository;
import club.joylink.xiannccda.ws.NccAlertMessageServer;
import club.joylink.xiannccda.ws.WsMessageServerManager;
import io.netty.util.internal.ObjectUtil;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
@ -61,14 +65,14 @@ public class AlertListenerJob implements ApplicationRunner {
OccClientMessage clientMessage = serverProto.getClientMessage(alertInfo.getLineId());
for (LineTypeEnum lineType : clientMessage.getLineTypes()) {
NccAlertMessageServer nccAlertMessageServer = NccAlertMessageServer.getInstance(lineType);
alertInfo.setLineType(lineType);
AlertRecord record = convertToRecord(alertInfo);
NccAlertInfo cloned = alertInfo.clone2();
// NccAlertInfo cloneNcc = ObjectUtils.clone(alertInfo);
cloned.setLineType(lineType);
AlertRecord record = convertToRecord(cloned);
alertRecordRepository.save(record);
alertInfo.setId(record.getId());
nccAlertMessageServer.addMsg(alertInfo);
cloned.setId(record.getId());
NccAlertMessageServer nccAlertMessageServer = NccAlertMessageServer.getInstance(lineType);
nccAlertMessageServer.addMsg(cloned);
}
}
});

View File

@ -11,8 +11,11 @@ import lombok.Getter;
import lombok.Setter;
@Getter
public class NccAlertInfo implements AlertInfo {
public class NccAlertInfo implements AlertInfo, Cloneable {
public NccAlertInfo() {
}
@Setter
private Integer id;
@ -53,6 +56,19 @@ public class NccAlertInfo implements AlertInfo {
this.alertDeviceType = alertDeviceType;
}
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
public NccAlertInfo clone2() {
try {
return (NccAlertInfo) this.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
public NccAlertInfo(LocalDateTime alertTime, AlertType alertType, Integer alertTipId,
Integer lineId, String alertObject, String locatorDeviceId,
Long alertLocationId, AlertDeviceType alertDeviceType) {