Merge branch 'master' into devs/app_approval
This commit is contained in:
+1
-2
@@ -79,8 +79,7 @@ dependencies {
|
||||
api "org.mapstruct:mapstruct:1.5.5.Final", "org.projectlombok:lombok:1.18.28"
|
||||
|
||||
// project > properties > Java Compiler > Annoation Processing
|
||||
annotationProcessor "org.projectlombok:lombok:1.18.28", "org.projectlombok:lombok-mapstruct-binding:0.2.0", "org.mapstruct:mapstruct-processor:1.5.5.Final"
|
||||
annotationProcessor "com.querydsl:querydsl-apt:${queryDslVersion}:jpa", "jakarta.persistence:jakarta.persistence-api:2.2.3", "jakarta.annotation:jakarta.annotation-api:1.3.5"
|
||||
annotationProcessor "org.projectlombok:lombok:1.18.28", "org.projectlombok:lombok-mapstruct-binding:0.2.0", "org.mapstruct:mapstruct-processor:1.5.5.Final", "com.querydsl:querydsl-apt:${queryDslVersion}:jpa", "jakarta.persistence:jakarta.persistence-api:2.2.3", "jakarta.annotation:jakarta.annotation-api:1.3.5"
|
||||
|
||||
// implementation files(rootProject.file('libs/elink-common-data-4.5.jar'));
|
||||
implementation 'com.eactive.elink.common:elink-common-data:4.5.5'
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.eactive.apim.portal.invitation.event;
|
||||
|
||||
import com.eactive.apim.portal.template.entity.MessageCode;
|
||||
import com.eactive.apim.portal.template.service.MessageEventHandler;
|
||||
import com.eactive.apim.portal.template.service.MessageRecipient;
|
||||
import com.eactive.apim.portal.template.service.MessageSendEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class UserInvitationCancelEvent implements MessageEventHandler {
|
||||
// public static final String KEY = "USER_INVITATION";
|
||||
public static final MessageCode KEY = MessageCode.USER_INVITATION_CANCELED;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean allowAdditionalRecipients() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageSendEvent createEvent(Object source, MessageRecipient recipient, Map<String, Object> params) {
|
||||
Map<String, String> requestParams = new HashMap<>();
|
||||
requestParams.put("corpName", params.get("corpName").toString());
|
||||
requestParams.put("managerName", params.get("managerName").toString());
|
||||
return new MessageSendEvent(source, KEY, recipient, requestParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageCode getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return "이메일 사용자 초대";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
/*
|
||||
{"CRPT_NM":"%corpName%","MNGR_NM":"%managerName%"}
|
||||
*/
|
||||
return "<div>사용 가능 변수: </div><br/>"
|
||||
+ "<div> - corpName: 회사명 </div><br/>"
|
||||
+ "<div> - managerName: 초대 담당자명 </div><br/>";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+15
-1
@@ -5,6 +5,7 @@ import com.eactive.eai.data.converter.LocalDateTimeToStringConverter14;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
@@ -18,7 +19,20 @@ public class PortalUserPrivacyAgreement extends Auditable implements Serializabl
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
// @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@GenericGenerator(
|
||||
name = "ptl_user_privacy_policy_agreement_gen",
|
||||
strategy = "com.eactive.eai.rms.data.jpa.SchemaPrefixedSequenceGenerator",
|
||||
parameters = {
|
||||
@org.hibernate.annotations.Parameter(name = "sequence_name", value = "PTL_USER_PRIVACY_POLICY_AGREEMENT_SEQ"),
|
||||
@org.hibernate.annotations.Parameter(name = "initial_value", value = "1"),
|
||||
@org.hibernate.annotations.Parameter(name = "increment_size", value = "1")
|
||||
}
|
||||
)
|
||||
@GeneratedValue(
|
||||
strategy = GenerationType.SEQUENCE,
|
||||
generator = "ptl_user_privacy_policy_agreement_gen"
|
||||
)
|
||||
@Column(name = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.eactive.apim.portal.portaluser.entity;
|
||||
import com.eactive.eai.data.converter.LocalDateTimeToStringConverter14;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.Parameter;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
@@ -15,8 +17,21 @@ public class UserPasswordHistory implements Serializable, com.eactive.eai.data.D
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", columnDefinition = "bigint")
|
||||
@GenericGenerator(
|
||||
name = "ptl_user_password_history_seq_gen",
|
||||
strategy = "com.eactive.eai.rms.data.jpa.SchemaPrefixedSequenceGenerator",
|
||||
parameters = {
|
||||
@Parameter(name = "sequence_name", value = "PTL_USER_PASSWORD_HISTORY_SEQ"),
|
||||
@Parameter(name = "initial_value", value = "1"),
|
||||
@Parameter(name = "increment_size", value = "1")
|
||||
}
|
||||
)
|
||||
@GeneratedValue(
|
||||
strategy = GenerationType.SEQUENCE,
|
||||
generator = "ptl_user_password_history_seq_gen"
|
||||
)
|
||||
// @Column(name = "id", columnDefinition = "bigint")
|
||||
@Column(name = "id", columnDefinition = "number(19)")
|
||||
private Long id;
|
||||
|
||||
@Column(name = "user_id", length = 35, nullable = false)
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.eactive.apim.portal.portaluser.event;
|
||||
|
||||
|
||||
import com.eactive.apim.portal.template.entity.MessageCode;
|
||||
import com.eactive.apim.portal.template.service.MessageEventHandler;
|
||||
import com.eactive.apim.portal.template.service.MessageRecipient;
|
||||
import com.eactive.apim.portal.template.service.MessageSendEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class UserAccountLockedEvent implements MessageEventHandler {
|
||||
|
||||
public static final MessageCode KEY = MessageCode.USER_ACCOUNT_LOCKED;
|
||||
|
||||
@Override
|
||||
public boolean allowAdditionalRecipients() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageSendEvent createEvent(Object source, MessageRecipient recipient, Map<String, Object> params) {
|
||||
Map<String, String> requestParams = new HashMap<>();
|
||||
if (params.containsKey("reason")) {
|
||||
requestParams.put("reason", String.valueOf(params.get("reason")));
|
||||
}
|
||||
return new MessageSendEvent(source, KEY, recipient, requestParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageCode getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return "계정 잠김 알림";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "<div>사용 가능 변수: </div><br/>"
|
||||
+ "<div> - reason 거부 사유 </div><br/>";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public enum MessageCode {
|
||||
|
||||
// 법인관리자 이벤트 영역
|
||||
USER_INVITATION("법인 이용자 이메일 초대", "FM_APIM005", Channels.EMAIL),
|
||||
USER_INVICATION_CANCELED("법인 이용자 이메일 초대 취소", "FM_APIM006", Channels.EMAIL),
|
||||
USER_INVITATION_CANCELED("법인 이용자 이메일 초대 취소", "FM_APIM006", Channels.EMAIL),
|
||||
|
||||
MANAGER_WITH_ORG_REGISTER_APPROVED("법인관리자 및 법인 등록 승인", "FM_APIM007", Channels.EMAIL),
|
||||
MANAGER_WITH_ORG_REGISTER_REJECTED("법인관리자 및 법인 등록 거절", "FM_APIM008", Channels.EMAIL),
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.apim.portal.template.entity.MessageCode;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
@@ -41,9 +42,15 @@ public class MessageHandlerService {
|
||||
}
|
||||
|
||||
public void publishEvent(MessageCode key, MessageRecipient recipient, Map<String, Object> params) {
|
||||
MessageSendEvent event = handlers.get(key.name()).createEvent(this, recipient, params);
|
||||
MessageSendEvent event = handlers.get(key.name())
|
||||
.createEvent(this, recipient, params);
|
||||
eventPublisher.publishEvent(event);
|
||||
}
|
||||
|
||||
public void publishEvent(MessageCode key, MessageRecipient recipient) {
|
||||
publishEvent(key, recipient, new HashMap<>());
|
||||
}
|
||||
|
||||
public void publishEvent(MessageSendEvent event) {
|
||||
eventPublisher.publishEvent(event);
|
||||
}
|
||||
@@ -53,5 +60,4 @@ public class MessageHandlerService {
|
||||
// messageSendService.sendMessage(event.getMessageType(), event.getRecipient(), event.getParams());
|
||||
messageSendService.sendMessage(event.getMessageCode(), event.getRecipient(), event.getParams());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.eactive.apim.portal.template.service;
|
||||
|
||||
import com.eactive.apim.portal.portaluser.entity.PortalUser;
|
||||
import kjb.safedb.KjbNotRnnoJpaAttributeConverter;
|
||||
import lombok.*;
|
||||
|
||||
@@ -10,10 +11,19 @@ import javax.persistence.Convert;
|
||||
@EqualsAndHashCode
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class MessageRecipient {
|
||||
private String username;
|
||||
private String userId; //email
|
||||
private String phone;
|
||||
private String messengerId;
|
||||
|
||||
|
||||
public static MessageRecipient of(PortalUser user) {
|
||||
MessageRecipient recipient = new MessageRecipient();
|
||||
recipient.setUsername(user.getUserName());
|
||||
recipient.setUserId(user.getEmailAddr());
|
||||
recipient.setPhone(user.getPhoneNumber());
|
||||
return recipient;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +141,10 @@ public class MessageSendService {
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> entry : params.entrySet()) {
|
||||
if (entry == null || entry.getKey() == null || entry.getValue() == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String key = "%" + entry.getKey() + "%";
|
||||
String value = entry.getValue().replace("$", "\\$");
|
||||
contents = contents.replaceAll(key, value);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.eactive.eai.rms.data;
|
||||
|
||||
public class PortalSchemaProviderHolder {
|
||||
private static SchemaProvider provider;
|
||||
|
||||
public static void setProvider(SchemaProvider p) {
|
||||
provider = p;
|
||||
}
|
||||
|
||||
public static String getSchema() {
|
||||
if (provider == null) {
|
||||
throw new IllegalStateException("SchemaProvider not initialized!");
|
||||
}
|
||||
return provider.getSchema();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.eactive.eai.rms.data;
|
||||
|
||||
public interface SchemaProvider {
|
||||
String getSchema();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.eactive.eai.rms.data.jpa;
|
||||
|
||||
import com.eactive.eai.rms.data.PortalSchemaProviderHolder;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.id.enhanced.SequenceStyleGenerator;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
public class SchemaPrefixedSequenceGenerator extends SequenceStyleGenerator {
|
||||
@Override
|
||||
public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException {
|
||||
|
||||
String raw = params.getProperty(SEQUENCE_PARAM);
|
||||
|
||||
if (!raw.contains(".")) {
|
||||
String schema = PortalSchemaProviderHolder.getSchema();
|
||||
params.setProperty(SEQUENCE_PARAM, schema + "." + raw);
|
||||
}
|
||||
|
||||
super.configure(type, params, serviceRegistry);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user