Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#307-sse-alarm
Browse files Browse the repository at this point in the history
  • Loading branch information
kbyunghoon committed Feb 13, 2025
2 parents c052dc0 + b682b71 commit d88618c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package org.collector.common.constant;

import org.collector.common.exception.CustomException;
import org.collector.common.response.ResponseCode;

import lombok.Getter;

@Getter
Expand All @@ -15,10 +12,4 @@ public enum CycleInfoSize {
CycleInfoSize(int size) {
this.size = size;
}

public void validate(int size) {
if (size >= this.size) {
throw new CustomException(ResponseCode.NOT_CYCLE_INFO_SIZE_ERROR);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.collector.application.CycleInfoService;
import org.collector.common.constant.CycleInfoSize;
import org.collector.presentation.dto.CycleInfoRequest;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.annotation.TopicPartition;
Expand All @@ -20,8 +19,6 @@ public class CycleInfoConsumer {
@KafkaListener(topicPartitions = @TopicPartition(topic = "cycleInfo-json-topic",
partitions = "#{@finder.partitions('cycleInfo-json-topic')}"))
public void accept(ConsumerRecord<String, CycleInfoRequest> message) {
CycleInfoSize.MIN_SIZE.validate(message.value().cList().size());

System.out.println("[Main Consumer] Message arrived! - " + message.value());
cycleInfoService.cycleInfoSave(message.value());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import jakarta.persistence.EntityListeners;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
Expand Down Expand Up @@ -42,7 +43,7 @@ public class CycleInfo {
private Integer ang;
private Integer spd;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "vehicle_id")
private VehicleInformation vehicleInformation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import jakarta.persistence.EntityListeners;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
Expand All @@ -39,10 +40,10 @@ public class VehicleInformation implements Serializable {
@Column(name = "vehicle_id")
private Long id;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "company_id")
private Company company;
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "vehicle_type_id")
private VehicleType vehicleType;
private String vehicleNumber;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.collector.presentation;

import org.collector.application.CycleInfoService;
import org.collector.common.constant.CycleInfoSize;
import org.collector.common.response.CommonResponse;
import org.collector.presentation.dto.CycleInfoRequest;
import org.collector.producer.CycleInfoProducer;
Expand All @@ -23,8 +22,6 @@ public class CycleInfoController {

@PostMapping
public CommonResponse<Void> cycleInfoSave(final @Valid @RequestBody CycleInfoRequest request) {
CycleInfoSize.MIN_SIZE.validate(request.cList().size());

Long mdn = cycleInfoService.cycleInfoSave(request);
cycleInfoProducer.sendMessage(request);
return CommonResponse.ok(mdn);
Expand Down

0 comments on commit d88618c

Please sign in to comment.