Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6670072
feat:more ble features
danbaram0420 Oct 1, 2025
f94a33c
Feat: 경로 리팩토링 및 셔틀버스 기능, 실내탐색 기능 최종구현
danbaram0420 Oct 15, 2025
ecf4d6a
Merge pull request #231 from DevKor-github/feat/ble2
dlwls423 Oct 16, 2025
3c3d60c
Feat: 로그 파일 추가
dlwls423 Oct 19, 2025
94ba88f
Remove: 기존 로그인 삭제
dlwls423 Oct 19, 2025
c50481a
Feat: 학식 크롤링 추가
dlwls423 Oct 19, 2025
567c22d
Feat: 학식 크롤링 추가
dlwls423 Oct 19, 2025
6895d57
Feat: 학식 크롤링 추가
dlwls423 Oct 19, 2025
c29ebc4
Merge pull request #232 from DevKor-github/feat/yejin
dlwls423 Oct 20, 2025
fc7a585
Fix: 학식 업데이트 오류 수정
dlwls423 Oct 20, 2025
5cf14c6
Merge pull request #233 from DevKor-github/feat/yejin
danbaram0420 Oct 20, 2025
3858029
임시 저장
dlwls423 Nov 13, 2025
9fb5bd5
Feat: 애플 서버 알림 개발 중
dlwls423 Nov 16, 2025
b4bad69
Feat: 학식 조회 api 추가
dlwls423 Nov 16, 2025
a10942b
Fix: 학식 조회 api 수정
dlwls423 Nov 16, 2025
c39261a
Fix: 학식 조회 api 수정
dlwls423 Nov 16, 2025
45371e7
Merge pull request #234 from DevKor-github/feat/menu
dlwls423 Nov 16, 2025
0b042b0
병합
dlwls423 Nov 19, 2025
8efd4e8
오류 수정
dlwls423 Nov 19, 2025
ab21ef6
Merge pull request #235 from DevKor-github/feat/apple
danbaram0420 Nov 19, 2025
c8f72eb
오류 수정
dlwls423 Nov 19, 2025
1e8fea4
Merge pull request #236 from DevKor-github/feat/apple
dlwls423 Nov 19, 2025
41664ce
오류 수정
dlwls423 Nov 19, 2025
c631e5d
Merge pull request #237 from DevKor-github/feat/apple
dlwls423 Nov 19, 2025
f781a94
오류 수정
dlwls423 Nov 19, 2025
d0917c3
Merge pull request #238 from DevKor-github/feat/apple
dlwls423 Nov 19, 2025
e3e4412
오류 수정
dlwls423 Nov 19, 2025
a3a60a0
Merge pull request #239 from DevKor-github/feat/apple
dlwls423 Nov 19, 2025
f4f2f9c
BLE api 수정 및 db형식에 맞게 변경
danbaram0420 Nov 24, 2025
0b08c95
Merge pull request #240 from DevKor-github/feat/ble
danbaram0420 Nov 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM openjdk:17
FROM amazoncorretto:17-alpine
COPY build/libs/team-c-back-0.0.1-SNAPSHOT.jar app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ dependencies {

// elasticsearch
// implementation 'org.springframework.boot:spring-boot-starter-data-elasticsearch'

// 크롤링
implementation 'org.jsoup:jsoup:1.17.2'

// Apple App Store Server Library
implementation 'com.apple.itunes.storekit:app-store-server-library:3.6.0'

}

dependencyManagement {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package devkor.com.teamcback.domain.ble.controller;

import devkor.com.teamcback.domain.ble.dto.request.CreateBLEReq;
import devkor.com.teamcback.domain.ble.dto.response.CreateBLERes;
import devkor.com.teamcback.domain.ble.entity.BLEDevice;
import devkor.com.teamcback.domain.ble.dto.request.CreateBLEDeviceReq;
import devkor.com.teamcback.domain.ble.dto.request.ModifyBLEDeviceReq;
import devkor.com.teamcback.domain.ble.dto.response.CreateBLEDeviceRes;
import devkor.com.teamcback.domain.ble.dto.response.DeleteBLEDeviceRes;
import devkor.com.teamcback.domain.ble.dto.response.ModifyBLEDeviceRes;
import devkor.com.teamcback.domain.ble.service.AdminBLEService;
import devkor.com.teamcback.global.response.CommonResponse;
import io.swagger.v3.oas.annotations.Operation;
Expand All @@ -13,10 +15,7 @@
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
Expand All @@ -34,8 +33,38 @@ public class AdminBLEController {
@ApiResponse(responseCode = "401", description = "권한이 없습니다.",
content = @Content(schema = @Schema(implementation = CommonResponse.class))),
})
public CommonResponse<CreateBLERes> createBLE(
@Parameter(description = "BLE장비 생성 요청 dto") @Valid @RequestBody CreateBLEReq createBLEReq) {
return CommonResponse.success(adminBLEService.CreateBLEDevice(createBLEReq));
public CommonResponse<CreateBLEDeviceRes> createBLE(
@Parameter(description = "BLE장비 생성 요청 dto") @Valid @RequestBody CreateBLEDeviceReq createBLEDeviceReq) {
return CommonResponse.success(adminBLEService.createBLEDevice(createBLEDeviceReq));
}

@PutMapping
@Operation(summary = "BLE장비 수정",
description = "BLE장비 수정")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "정상 처리 되었습니다."),
@ApiResponse(responseCode = "404", description = "장비를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = CommonResponse.class))),
@ApiResponse(responseCode = "401", description = "권한이 없습니다.",
content = @Content(schema = @Schema(implementation = CommonResponse.class))),
})
public CommonResponse<ModifyBLEDeviceRes> modifyBLE(
@Parameter(description = "BLE장비 수정 요청 dto") @Valid @RequestBody ModifyBLEDeviceReq modifyBLEDeviceReq) {
return CommonResponse.success(adminBLEService.modifyBLEDevice(modifyBLEDeviceReq));
}

@DeleteMapping("/{bleId}")
@Operation(summary = "BLE장비 삭제",
description = "BLE장비 삭제")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "정상 처리 되었습니다."),
@ApiResponse(responseCode = "404", description = "장비를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = CommonResponse.class))),
@ApiResponse(responseCode = "401", description = "권한이 없습니다.",
content = @Content(schema = @Schema(implementation = CommonResponse.class))),
})
public CommonResponse<DeleteBLEDeviceRes> deleteBLE(
@Parameter(description = "BLE장비 삭제 요청 dto") @PathVariable Long bleId) {
return CommonResponse.success(adminBLEService.deleteBLEDevice(bleId));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package devkor.com.teamcback.domain.ble.controller;

import devkor.com.teamcback.domain.ble.dto.request.UpdateBLEReq;
import devkor.com.teamcback.domain.ble.dto.response.BLETimePatternRes;
import devkor.com.teamcback.domain.ble.dto.response.GetBLERes;
import devkor.com.teamcback.domain.ble.dto.response.UpdateBLERes;
import devkor.com.teamcback.domain.ble.service.BLEService;
Expand Down Expand Up @@ -41,8 +42,25 @@ public CommonResponse<GetBLERes> getBLE(
}

@PutMapping
@Operation(summary = "ble 기기에서 전송하는 데이터 통한 데이터 축적",
description = "ble 기기에서 전송하는 데이터 통한 데이터 축적")
public CommonResponse<UpdateBLERes> updateBLE(
@Valid @RequestBody UpdateBLEReq updateBLEReq){
return CommonResponse.success(bleService.updateBLEDevice(updateBLEReq));
return CommonResponse.success(bleService.updateBLE(updateBLEReq));
}

@GetMapping("/pattern")
@Operation(summary = "BLE 요일/시간대별 평균 인원 조회",
description = "최근 1달 동안 특정 placeId에 대해 요일별 7/10/13/16/19/22시 기준 평균 인원 수를 반환")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "정상 처리 되었습니다."),
@ApiResponse(responseCode = "404", description = "장소 또는 장비를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = CommonResponse.class))),
})
public CommonResponse<BLETimePatternRes> getBLETimePattern(
@Parameter(name="placeId", description = "BLE 정보를 얻고자 하는 placeId")
@RequestParam Long placeId) {
return CommonResponse.success(bleService.getBLETimePattern(placeId));
}

}
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package devkor.com.teamcback.domain.ble.dto.request;

import devkor.com.teamcback.domain.ble.entity.BLEstatus;
import devkor.com.teamcback.domain.place.entity.Place;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalTime;

@Schema(description = "BLEdevice 생성 정보")
@Getter
@Setter
public class CreateBLEReq {
public class CreateBLEDeviceReq {
@Schema(description = "라운지 설치된 기기명", example = "woodang_1f_lounge")
private String deviceName;
@Schema(description ="라운지 place")
private Long placeId;
@Schema(description = "라운지별 최대정원", example = "20")
private int capacity;
@Schema(description = "위치별 기본 시간별 카운팅 횟수", example = "30")
private int defaultCount;
@Schema(description = "위치별 기본 시간별 평균 기기 신호 횟수", example = "100")
private int ratio;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package devkor.com.teamcback.domain.ble.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

@Schema(description = "BLEdevice 생성 정보")
@Getter
@Setter
public class ModifyBLEDeviceReq {
@Schema(description = "수정하고자 하는 BLEDevice ID", example = "1")
private Long id;
@Schema(description = "라운지 설치된 기기명", example = "woodang_1f_lounge")
private String deviceName;
@Schema(description ="라운지 place")
private Long placeId;
@Schema(description = "라운지별 최대정원", example = "20")
private int capacity;
@Schema(description = "위치별 기본 시간별 카운팅 횟수", example = "30")
private int defaultCount;
@Schema(description = "위치별 기본 시간별 평균 기기 신호 횟수", example = "100")
private int ratio;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
@Getter
@Setter
public class UpdateBLEReq {
@Schema(description = "라운지 설치된 기기명", example = "woodang_1f_lounge")
@Schema(description = "라운지 설치된 기기명", example = "SKFutureHall_5f_lounge_517")
private String deviceName;
@Schema(description = "최근 감지 인원", example = "10")
@Schema(description = "최근 감지 신호 개수", example = "10")
private int lastCount;
@Schema(description = "최근 신호 전송 시간")
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package devkor.com.teamcback.domain.ble.dto.response;

import lombok.Getter;

@Getter
public class BLETimePatternRes {
private Long placeId; // 요청 placeId
private int[] hours; // {7,10,13,16,19,21,24}
private int[] dayOfWeeks; // {1,2,3,4,5,6,7} (java.time.DayOfWeek 값)
private int[][] averages; // [dayIndex][timeIndex] 형태, 각 원소는 반올림된 int

public BLETimePatternRes(Long placeId, int[] timeSlots, int[] dayOfWeeks, int[][] averages) {
this.placeId = placeId;
this.hours = timeSlots;
this.dayOfWeeks = dayOfWeeks;
this.averages = averages;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

@Schema(description = "BLEdevice 생성 정보")
@Getter
public class CreateBLERes {
public class CreateBLEDeviceRes {
private Long id;

public CreateBLERes(BLEDevice bleDevice) {
public CreateBLEDeviceRes(BLEDevice bleDevice) {
this.id = bleDevice.getId();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package devkor.com.teamcback.domain.ble.dto.response;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "BLEDevice 삭제 응답 dto")
@JsonIgnoreProperties
public class DeleteBLEDeviceRes {
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public class GetBLERes {
private int lastStatus;
private LocalDateTime lastTime;

public GetBLERes(BLEDevice device, BLEData data, BLEstatus status) {
public GetBLERes(BLEDevice device, BLEData data, BLEstatus status, int people) {
this.id = device.getId();
this.deviceName = device.getDeviceName();
this.placeId = device.getPlace().getId();
this.capacity = device.getCapacity();
this.lastCount = data.getLastCount();
this.lastCount = people;
this.lastStatus = status.getCode();
this.lastTime = data.getLastTime();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package devkor.com.teamcback.domain.ble.dto.response;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "BLEDevice 수정 응답 dto")
@JsonIgnoreProperties
public class ModifyBLEDeviceRes {
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class UpdateBLERes {
@Schema(description = "라운지 설치된 기기명", example = "woodang_1f_lounge")
private Long deviceId;
@Schema(description = "최근 감지 인원", example = "10")
@Schema(description = "최근 감지 인원(10의 자리 반올림)", example = "10")
private int lastCount;
@Schema(description = "최근 Status", example = "AVAILABLE")
private BLEstatus lastStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package devkor.com.teamcback.domain.ble.entity;


import devkor.com.teamcback.domain.ble.dto.request.UpdateBLEReq;
import devkor.com.teamcback.domain.ble.dto.request.CreateBLEDeviceReq;
import devkor.com.teamcback.domain.ble.dto.request.ModifyBLEDeviceReq;
import devkor.com.teamcback.domain.common.entity.BaseEntity;
import devkor.com.teamcback.domain.place.entity.Place;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.time.LocalDateTime;

@Entity
@Table(name="tb_ble_device")
@Getter
Expand All @@ -31,10 +30,26 @@ public class BLEDevice extends BaseEntity {
@Column
private int capacity;

public BLEDevice(String deviceName, Place place, int capacity) {
this.deviceName = deviceName;
@Column(name="default_count")
private double defaultCount;

@Column
private double ratio;

public BLEDevice(CreateBLEDeviceReq req, Place place) {
this.deviceName = req.getDeviceName();
this.place = place;
this.capacity = req.getCapacity();
this.defaultCount = req.getDefaultCount();
this.ratio = req.getRatio();
}

public void update(ModifyBLEDeviceReq req, Place place){
this.deviceName = req.getDeviceName();
this.place = place;
this.capacity = capacity;
this.capacity = req.getCapacity();
this.defaultCount = req.getDefaultCount();
this.ratio = req.getRatio();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.CrudRepository;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

public interface BLEDataRepository extends JpaRepository<BLEData, Long> {
Optional<BLEData> findTopByDeviceOrderByLastTimeDesc(BLEDevice device);
List<BLEData> findAllByDeviceAndLastTimeBetweenOrderByLastTimeAsc(BLEDevice device, LocalDateTime start, LocalDateTime end);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import java.util.List;

public interface BLEDeviceRepository extends JpaRepository<BLEDevice, Long> {
List<BLEDevice> findByDeviceName(String deviceName);
List<BLEDevice> findByPlace(Place place);
BLEDevice findByDeviceName(String deviceName);
BLEDevice findByPlace(Place place);
boolean existsByDeviceName(String deviceName);
boolean existsByPlace(Place place);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package devkor.com.teamcback.domain.ble.service;

import devkor.com.teamcback.domain.ble.dto.request.CreateBLEReq;
import devkor.com.teamcback.domain.ble.dto.response.CreateBLERes;
import devkor.com.teamcback.domain.ble.dto.request.CreateBLEDeviceReq;
import devkor.com.teamcback.domain.ble.dto.request.ModifyBLEDeviceReq;
import devkor.com.teamcback.domain.ble.dto.response.CreateBLEDeviceRes;
import devkor.com.teamcback.domain.ble.dto.response.DeleteBLEDeviceRes;
import devkor.com.teamcback.domain.ble.dto.response.ModifyBLEDeviceRes;
import devkor.com.teamcback.domain.ble.entity.BLEDevice;
import devkor.com.teamcback.domain.ble.repository.BLEDeviceRepository;
import devkor.com.teamcback.domain.place.entity.Place;
Expand All @@ -12,19 +15,40 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import static devkor.com.teamcback.global.response.ResultCode.NOT_FOUND_PLACE;
import java.util.Objects;

@Service
@RequiredArgsConstructor
public class AdminBLEService {
private final BLEDeviceRepository bleDeviceRepository;
private final PlaceRepository placeRepository;

//bledevice 생성
@Transactional
public CreateBLERes CreateBLEDevice(CreateBLEReq createBLEReq) {
Place place = placeRepository.findById(createBLEReq.getPlaceId()).orElseThrow(() -> new GlobalException(NOT_FOUND_PLACE));
if (bleDeviceRepository.existsByDeviceName(createBLEReq.getDeviceName())) throw new GlobalException(ResultCode.EXISTING_DEVICE_NAME);
BLEDevice bleDevice = bleDeviceRepository.save(new BLEDevice(createBLEReq.getDeviceName(), place, createBLEReq.getCapacity()));
return new CreateBLERes(bleDevice);
public CreateBLEDeviceRes createBLEDevice(CreateBLEDeviceReq createBLEDeviceReq) {
Place place = placeRepository.findById(createBLEDeviceReq.getPlaceId()).orElseThrow(() -> new GlobalException(ResultCode.NOT_FOUND_PLACE));
if (bleDeviceRepository.existsByDeviceName(createBLEDeviceReq.getDeviceName())) throw new GlobalException(ResultCode.EXISTING_DEVICE_NAME);
if (bleDeviceRepository.existsByPlace(place)) throw new GlobalException(ResultCode.EXISTING_PLACE_FOR_DEVICE);
BLEDevice bleDevice = bleDeviceRepository.save(new BLEDevice(createBLEDeviceReq, place));
return new CreateBLEDeviceRes(bleDevice);
}

//bledevice 수정
@Transactional
public ModifyBLEDeviceRes modifyBLEDevice(ModifyBLEDeviceReq modifyBLEReq){
Place place = placeRepository.findById(modifyBLEReq.getPlaceId()).orElseThrow(() -> new GlobalException(ResultCode.NOT_FOUND_PLACE));
BLEDevice bleDevice = bleDeviceRepository.findById(modifyBLEReq.getId()).orElseThrow(() -> new GlobalException(ResultCode.NOT_FOUND_DEVICE));
if (bleDeviceRepository.existsByDeviceName(modifyBLEReq.getDeviceName()) && !Objects.equals(modifyBLEReq.getDeviceName(), bleDevice.getDeviceName())) throw new GlobalException(ResultCode.EXISTING_DEVICE_NAME);
if (bleDeviceRepository.existsByPlace(place) && !Objects.equals(modifyBLEReq.getPlaceId(), bleDevice.getPlace().getId())) throw new GlobalException(ResultCode.EXISTING_PLACE_FOR_DEVICE);
bleDevice.update(modifyBLEReq, place);
return new ModifyBLEDeviceRes();
}

//bledevice 삭제
@Transactional
public DeleteBLEDeviceRes deleteBLEDevice(Long bleId) {
BLEDevice bleDevice = bleDeviceRepository.findById(bleId).orElseThrow(() -> new GlobalException(ResultCode.NOT_FOUND_DEVICE));
bleDeviceRepository.delete(bleDevice);
return new DeleteBLEDeviceRes();
}
}
Loading
Loading