-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from JNU-econovation/network
network-api 서버 리팩토링
- Loading branch information
Showing
23 changed files
with
36 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../network_log/config/PropertiesConfig.java → ...n/log_writer/config/PropertiesConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 11 additions & 13 deletions
24
...infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogDAO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
package com.whoz_in.log_writer.monitor; | ||
|
||
import jakarta.persistence.EntityManager; | ||
import jakarta.persistence.PersistenceContext; | ||
import java.util.Collection; | ||
import org.springframework.data.jpa.repository.Modifying; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
import org.springframework.stereotype.Repository; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class MonitorLogDAO { | ||
@PersistenceContext | ||
private EntityManager em; | ||
|
||
@Modifying | ||
@Transactional | ||
private final JdbcTemplate jdbcTemplate; | ||
|
||
public void upsertAll(Collection<String> macs) { | ||
if (macs.isEmpty()) return; | ||
StringBuilder sql = new StringBuilder("INSERT INTO monitor_log (mac, created_date, updated_date) VALUES "); | ||
macs.forEach(mac -> sql.append(String.format("('%s', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),", mac))); | ||
sql.setLength(sql.length() - 1); | ||
sql.append(" ON DUPLICATE KEY UPDATE updated_date = CURRENT_TIMESTAMP"); | ||
em.createNativeQuery(sql.toString()).executeUpdate(); | ||
|
||
String sql = "INSERT INTO monitor_log (mac, created_at, updated_at) VALUES (?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP) ON DUPLICATE KEY UPDATE updated_at = CURRENT_TIMESTAMP"; | ||
jdbcTemplate.batchUpdate(sql, macs, macs.size(), | ||
(ps, mac) -> ps.setString(1, mac)); | ||
} | ||
|
||
|
||
} |
21 changes: 0 additions & 21 deletions
21
modules/infrastructure/log-writer/src/main/resources/application-jpa.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
.../log-api/src/main/java/com/whoz_in/network_log/common/util/NonBlockingBufferedReader.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
spring: | ||
application: | ||
name: WhozIn-Network | ||
|
||
profiles: | ||
group: | ||
local: | ||
- log-writer | ||
active: local |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters