This commit is contained in:
parent
69eed1fc96
commit
fa1a3c9f51
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user