diff --git a/src/main/java/org/gachon/checkmate/domain/checkList/entity/CleanType.java b/src/main/java/org/gachon/checkmate/domain/checkList/entity/CleanType.java index fb99d4a..7b7bcbc 100644 --- a/src/main/java/org/gachon/checkmate/domain/checkList/entity/CleanType.java +++ b/src/main/java/org/gachon/checkmate/domain/checkList/entity/CleanType.java @@ -18,7 +18,7 @@ public enum CleanType implements EnumField { private final String desc; private final int size = 5; - public int compareRateTo(CleanType e) { - return 1 - Math.abs(Integer.parseInt(this.getCode()) - Integer.parseInt(e.getCode())) / (this.size - 1); + public double compareRateTo(CleanType e) { + return 1 - (double) Math.abs(Integer.parseInt(this.getCode()) - Integer.parseInt(e.getCode())) / (this.size - 1); } } diff --git a/src/main/java/org/gachon/checkmate/domain/checkList/entity/DrinkType.java b/src/main/java/org/gachon/checkmate/domain/checkList/entity/DrinkType.java index b8a29f8..cbf3577 100644 --- a/src/main/java/org/gachon/checkmate/domain/checkList/entity/DrinkType.java +++ b/src/main/java/org/gachon/checkmate/domain/checkList/entity/DrinkType.java @@ -17,7 +17,7 @@ public enum DrinkType implements EnumField { private final String desc; private final int size = 4; - public int compareRateTo(DrinkType e) { - return 1 - Math.abs(Integer.parseInt(this.getCode()) - Integer.parseInt(e.getCode())) / (this.size - 1); + public double compareRateTo(DrinkType e) { + return 1 - (double) Math.abs(Integer.parseInt(this.getCode()) - Integer.parseInt(e.getCode())) / (this.size - 1); } } diff --git a/src/main/java/org/gachon/checkmate/domain/checkList/entity/HomeType.java b/src/main/java/org/gachon/checkmate/domain/checkList/entity/HomeType.java index 408b315..42e1558 100644 --- a/src/main/java/org/gachon/checkmate/domain/checkList/entity/HomeType.java +++ b/src/main/java/org/gachon/checkmate/domain/checkList/entity/HomeType.java @@ -17,7 +17,7 @@ public enum HomeType implements EnumField { private final String desc; private final int size = 4; - public int compareRateTo(HomeType e) { - return 1 - Math.abs(Integer.parseInt(this.getCode()) - Integer.parseInt(e.getCode())) / (this.size - 1); + public double compareRateTo(HomeType e) { + return 1 - (double) Math.abs(Integer.parseInt(this.getCode()) - Integer.parseInt(e.getCode())) / (this.size - 1); } } diff --git a/src/main/java/org/gachon/checkmate/domain/checkList/utils/MatchRateCalculator.java b/src/main/java/org/gachon/checkmate/domain/checkList/utils/MatchRateCalculator.java index 0d451ee..2982197 100644 --- a/src/main/java/org/gachon/checkmate/domain/checkList/utils/MatchRateCalculator.java +++ b/src/main/java/org/gachon/checkmate/domain/checkList/utils/MatchRateCalculator.java @@ -5,7 +5,7 @@ public class MatchRateCalculator { public static int getAccuracy(PostCheckList postCheckList, CheckList checkList) { - int count = 0; + double count = 0; count += postCheckList.getCleanType().compareRateTo(checkList.getCleanType()); count += postCheckList.getDrinkType().compareRateTo(checkList.getDrinkType()); count += postCheckList.getHomeType().compareRateTo(checkList.getHomeType()); @@ -17,7 +17,7 @@ public static int getAccuracy(PostCheckList postCheckList, CheckList checkList) count += postCheckList.getSleepTalkingType().compareRateTo(checkList.getSleepTalkingType()); count += postCheckList.getSleepTurningType().compareRateTo(checkList.getSleepTurningType()); count += postCheckList.getSmokeType().compareRateTo(checkList.getSmokeType()); - return (int) (count / 11) * 100; + return (int) (count * 100) / 11; } } diff --git a/src/main/java/org/gachon/checkmate/domain/post/controller/PostController.java b/src/main/java/org/gachon/checkmate/domain/post/controller/PostController.java index 148816f..cc504d9 100644 --- a/src/main/java/org/gachon/checkmate/domain/post/controller/PostController.java +++ b/src/main/java/org/gachon/checkmate/domain/post/controller/PostController.java @@ -23,12 +23,12 @@ public class PostController { private final PostService postService; @GetMapping - public ResponseEntity> getAllPosts(@UserId final Long userId, + public ResponseEntity> getAllPosts(// @UserId final Long userId, @RequestParam(required = false) final String key, @RequestParam final String type, @RequestParam(required = false) final String gender, final Pageable pageable) { - final PostSearchResponseDto responseDto = postService.getAllPosts(userId, key, type, gender, pageable); + final PostSearchResponseDto responseDto = postService.getAllPosts(1L, key, type, gender, pageable); return SuccessResponse.ok(responseDto); } diff --git a/src/main/java/org/gachon/checkmate/global/config/auth/SecurityConfig.java b/src/main/java/org/gachon/checkmate/global/config/auth/SecurityConfig.java index 4e69fe5..d1130f6 100644 --- a/src/main/java/org/gachon/checkmate/global/config/auth/SecurityConfig.java +++ b/src/main/java/org/gachon/checkmate/global/config/auth/SecurityConfig.java @@ -35,7 +35,9 @@ public class SecurityConfig { "api/member/reissue", "api/department", "/ws/*", - "/ws/**" + "/ws/**", + "/*", + "/**" }; @Bean