From c57dfe7d52188f358cb583404cbf3c3478a38559 Mon Sep 17 00:00:00 2001 From: LHS-11 Date: Thu, 21 Dec 2023 22:29:14 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EC=A0=95=EC=B1=85=20=EC=8B=A0?= =?UTF-8?q?=EC=B2=AD=20=EB=B0=A9=EB=B2=95=20Enum=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ( 온라인신청, 방문신청, 우편신청, 그 외 ) --- .../policy/domain/enums/PolicyMethodType.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/main/java/com/cmc/zenefitserver/domain/policy/domain/enums/PolicyMethodType.java diff --git a/src/main/java/com/cmc/zenefitserver/domain/policy/domain/enums/PolicyMethodType.java b/src/main/java/com/cmc/zenefitserver/domain/policy/domain/enums/PolicyMethodType.java new file mode 100644 index 0000000..22bc861 --- /dev/null +++ b/src/main/java/com/cmc/zenefitserver/domain/policy/domain/enums/PolicyMethodType.java @@ -0,0 +1,33 @@ +package com.cmc.zenefitserver.domain.policy.domain.enums; + +import lombok.Getter; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Stream; + +@Getter +public enum PolicyMethodType { + + ONLINE("온라인신청", Arrays.asList("온라인", "누리집", "홈페이지", "포털", "블로그", "이메일", "모바일", "email", "e-mail", "e-메일", "팩스", "전화", "워크넷", "https", "www")), + LETTER("우편신청", Arrays.asList("우편")), + VISIT("방문신청", Arrays.asList("방문", "읍면", "사무소", "사무실", "센터", "관할", "내방")), + BLANK("빈값", Collections.emptyList()); + + private final String description; + + private final List keywords; + + PolicyMethodType(String description, List keywords) { + this.description = description; + this.keywords = keywords; + } + + public static PolicyMethodType findPolicyMethodTypeByKeywords(String text) { + return Arrays.stream(PolicyMethodType.values()) + .filter(policyMethodType -> policyMethodType.keywords.stream().anyMatch(text::contains)) + .findFirst() + .orElse(BLANK); + } +}