Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 72d2150a6e | |||
| c8049dd881 | |||
| 2e2ac8f462 | |||
| f3a9e19b89 | |||
| b5866b087d | |||
| 6f00de61d9 | |||
| e5d0acf694 |
+15
@@ -4,8 +4,23 @@ import com.eactive.apim.portal.portalproperty.entity.PortalProperty;
|
|||||||
import com.eactive.apim.portal.portalproperty.entity.PortalPropertyId;
|
import com.eactive.apim.portal.portalproperty.entity.PortalPropertyId;
|
||||||
import com.eactive.eai.data.jpa.BaseRepository;
|
import com.eactive.eai.data.jpa.BaseRepository;
|
||||||
import com.eactive.eai.rms.data.EMSDataSource;
|
import com.eactive.eai.rms.data.EMSDataSource;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@EMSDataSource
|
@EMSDataSource
|
||||||
public interface PortalPropertyRepository extends BaseRepository<PortalProperty, PortalPropertyId> {
|
public interface PortalPropertyRepository extends BaseRepository<PortalProperty, PortalPropertyId> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (PROPERTY_GROUP_NAME, PROPERTY_NAME) 조합이 2건 이상인 중복 키를 조회한다.
|
||||||
|
* DB에 유니크 제약을 걸지 않으므로 기동 시 무결성 점검용으로 사용한다.
|
||||||
|
*
|
||||||
|
* @return {@code Object[]{propertyGroupName, propertyName, count}} 목록 (중복 없으면 빈 리스트)
|
||||||
|
*/
|
||||||
|
@Query("SELECT p.id.propertyGroupName, p.id.propertyName, COUNT(p) "
|
||||||
|
+ "FROM PortalProperty p "
|
||||||
|
+ "GROUP BY p.id.propertyGroupName, p.id.propertyName "
|
||||||
|
+ "HAVING COUNT(p) > 1")
|
||||||
|
List<Object[]> findDuplicatePropertyKeys();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-1
@@ -51,13 +51,24 @@ public class PortalPropertyService extends AbstractDataService<PortalPropertyGro
|
|||||||
Optional<PortalProperty> existingProperty = portalPropertyRepository.findById(propertyId);
|
Optional<PortalProperty> existingProperty = portalPropertyRepository.findById(propertyId);
|
||||||
|
|
||||||
if (existingProperty.isPresent()) {
|
if (existingProperty.isPresent()) {
|
||||||
return existingProperty.get().getPropertyValue();
|
PortalProperty property = existingProperty.get();
|
||||||
|
// 설명(property_desc)이 비어 있으면 코드가 넘긴 description 으로 채운다.
|
||||||
|
// (값이 있으면 관리자 편집분 보존 — 덮어쓰지 않음)
|
||||||
|
if (isBlank(property.getPropertyDesc()) && !isBlank(description)) {
|
||||||
|
property.setPropertyDesc(description);
|
||||||
|
portalPropertyRepository.save(property);
|
||||||
|
}
|
||||||
|
return property.getPropertyValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 프로퍼티가 없으면 기본값으로 생성
|
// 프로퍼티가 없으면 기본값으로 생성
|
||||||
return createDefaultProperty(groupName, propertyName, defaultValue, description);
|
return createDefaultProperty(groupName, propertyName, defaultValue, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isBlank(String s) {
|
||||||
|
return s == null || s.trim().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 기본 프로퍼티를 DB에 생성
|
* 기본 프로퍼티를 DB에 생성
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -86,4 +86,23 @@ public class Inquiry extends Auditable {
|
|||||||
|
|
||||||
@Column(name = "ATTACH_FILE")
|
@Column(name = "ATTACH_FILE")
|
||||||
private String attachFile;
|
private String attachFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 공개범위 (전체공개/법인공개/비공개). 기본값 ORG.
|
||||||
|
* PTL_PROPERTY 기관 기본값이 상한(ceiling)이며 읽기/쓰기 시 clamp 된다.
|
||||||
|
*/
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "VISIBILITY", length = 16)
|
||||||
|
private VisibilityScope visibility = VisibilityScope.ORG;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 조회수. sessionStorage 기반 dedup 후 POST 요청으로만 증가한다.
|
||||||
|
*/
|
||||||
|
@Column(name = "VIEW_COUNT")
|
||||||
|
private long viewCount = 0L;
|
||||||
|
|
||||||
|
/** 조회수 1 증가. */
|
||||||
|
public void increaseViewCount() {
|
||||||
|
this.viewCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,18 @@ public class InquiryComment extends Auditable implements Serializable {
|
|||||||
@Column(name = "ADMIN_YN", length = 1)
|
@Column(name = "ADMIN_YN", length = 1)
|
||||||
private String adminYn = "N";
|
private String adminYn = "N";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 댓글 공개범위. 개념상 공개(ALL)/비공개(PRIVATE) 2단계.
|
||||||
|
* 비공개 댓글은 작성자·같은 법인 corp-manager·관리자만 열람 가능.
|
||||||
|
*/
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "VISIBILITY", length = 16)
|
||||||
|
private VisibilityScope visibility = VisibilityScope.ALL;
|
||||||
|
|
||||||
|
public boolean isPrivate() {
|
||||||
|
return this.visibility == VisibilityScope.PRIVATE;
|
||||||
|
}
|
||||||
|
|
||||||
public void markDeleted() {
|
public void markDeleted() {
|
||||||
this.delYn = "Y";
|
this.delYn = "Y";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.eactive.apim.portal.qna.entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 문의(Q&A) 게시물/댓글의 공개범위.
|
||||||
|
*
|
||||||
|
* <p>{@code width}는 공개 범위의 넓이 랭크로, 값이 클수록 더 넓게 공개된다.
|
||||||
|
* {@code PTL_PROPERTY}에 설정된 기관 기본값이 상한(ceiling)이 되며, 게시물이 상한보다
|
||||||
|
* 넓게 설정될 수 없다({@link #clampTo}). property가 항상 우선한다.</p>
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>{@code ALL} : 전체 로그인 사용자 공개</li>
|
||||||
|
* <li>{@code ORG} : 같은 법인 소속 사용자 공개 (게시물 기본값)</li>
|
||||||
|
* <li>{@code PRIVATE} : 작성자 본인만 (댓글의 "비공개")</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public enum VisibilityScope {
|
||||||
|
|
||||||
|
ALL(3, "전체공개"),
|
||||||
|
ORG(2, "법인공개"),
|
||||||
|
PRIVATE(1, "비공개");
|
||||||
|
|
||||||
|
private final int width;
|
||||||
|
private final String label;
|
||||||
|
|
||||||
|
VisibilityScope(int width, String label) {
|
||||||
|
this.width = width;
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 공개 범위 넓이 랭크. 클수록 넓게 공개. */
|
||||||
|
public int width() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 화면 표기용 한글 라벨. */
|
||||||
|
public String label() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 문자열을 enum으로 안전 변환. null/빈값/미해당은 defaultScope 반환.
|
||||||
|
*/
|
||||||
|
public static VisibilityScope fromString(String value, VisibilityScope defaultScope) {
|
||||||
|
if (value == null || value.trim().isEmpty()) {
|
||||||
|
return defaultScope;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return VisibilityScope.valueOf(value.trim().toUpperCase());
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return defaultScope;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 요청 공개범위를 상한으로 clamp 한다. 요청이 상한보다 넓으면 상한으로 낮춘다.
|
||||||
|
* (property가 항상 우선하므로, 저장값이 옛 상한이라 더 넓더라도 읽기 시 재-clamp 한다.)
|
||||||
|
*/
|
||||||
|
public static VisibilityScope clampTo(VisibilityScope requested, VisibilityScope ceiling) {
|
||||||
|
if (requested == null) {
|
||||||
|
return ceiling;
|
||||||
|
}
|
||||||
|
if (ceiling == null) {
|
||||||
|
return requested;
|
||||||
|
}
|
||||||
|
return requested.width() > ceiling.width() ? ceiling : requested;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -78,7 +78,7 @@ public class MessageSendService {
|
|||||||
String subject = buildMessage(template.getSubjectTemplate(), messageParams);
|
String subject = buildMessage(template.getSubjectTemplate(), messageParams);
|
||||||
|
|
||||||
if (template.getEnableSms().equalsIgnoreCase("Y")) {
|
if (template.getEnableSms().equalsIgnoreCase("Y")) {
|
||||||
String smsEaiInterfaceId = portalProperties.get("ums.sms.if_id");
|
String smsEaiInterfaceId = portalProperties.get("djb.ums.sms.if_id");
|
||||||
MessageRequest smsRequest = new MessageRequest();
|
MessageRequest smsRequest = new MessageRequest();
|
||||||
smsRequest.setMessageCode(MessageCode.valueOf(template.getMessageCode().toUpperCase()));
|
smsRequest.setMessageCode(MessageCode.valueOf(template.getMessageCode().toUpperCase()));
|
||||||
smsRequest.setSubject(subject);
|
smsRequest.setSubject(subject);
|
||||||
@@ -88,19 +88,15 @@ public class MessageSendService {
|
|||||||
smsRequest.setUsername(user.getUsername());
|
smsRequest.setUsername(user.getUsername());
|
||||||
smsRequest.setPhone(user.getPhone());
|
smsRequest.setPhone(user.getPhone());
|
||||||
smsRequest.setEaiInterfaceId(smsEaiInterfaceId);
|
smsRequest.setEaiInterfaceId(smsEaiInterfaceId);
|
||||||
smsRequest.setServiceId(portalProperties.get("ums.sms.tx_id"));
|
smsRequest.setServiceId(portalProperties.get("djb.ums.sms.tx_id"));
|
||||||
smsRequest.setUserId(user.getUserId());
|
smsRequest.setUserId(user.getUserId());
|
||||||
if ("ADMIN_VERIFICATION_MOBILEPHONE".equals(template.getMessageCode().toUpperCase())) {
|
smsRequest.setMessageType("KAKAO");
|
||||||
smsRequest.setMessageType("KAKAO");
|
|
||||||
} else {
|
|
||||||
smsRequest.setMessageType("SMS");
|
|
||||||
}
|
|
||||||
messageRequestRepository.save(smsRequest);
|
messageRequestRepository.save(smsRequest);
|
||||||
logger.debug(smsRequest.toString());
|
logger.debug(smsRequest.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (template.getEnableEmail().equalsIgnoreCase("Y")) {
|
if (template.getEnableEmail().equalsIgnoreCase("Y")) {
|
||||||
String mailEaiInterfaceId = portalProperties.get("ums.email.if_id");
|
String mailEaiInterfaceId = portalProperties.get("djb.ums.email.if_id");
|
||||||
MessageRequest emailRequest = new MessageRequest();
|
MessageRequest emailRequest = new MessageRequest();
|
||||||
emailRequest.setMessageCode(MessageCode.valueOf(template.getMessageCode().toUpperCase()));
|
emailRequest.setMessageCode(MessageCode.valueOf(template.getMessageCode().toUpperCase()));
|
||||||
emailRequest.setSubject(subject);
|
emailRequest.setSubject(subject);
|
||||||
@@ -110,7 +106,7 @@ public class MessageSendService {
|
|||||||
emailRequest.setUsername(user.getUsername());
|
emailRequest.setUsername(user.getUsername());
|
||||||
emailRequest.setEmail(user.getUserId());
|
emailRequest.setEmail(user.getUserId());
|
||||||
emailRequest.setEaiInterfaceId(mailEaiInterfaceId);
|
emailRequest.setEaiInterfaceId(mailEaiInterfaceId);
|
||||||
emailRequest.setServiceId(portalProperties.get("ums.email.tx_id"));
|
emailRequest.setServiceId(portalProperties.get("djb.ums.email.tx_id"));
|
||||||
emailRequest.setMessageType("EMAIL");
|
emailRequest.setMessageType("EMAIL");
|
||||||
emailRequest.setUserId(user.getUserId());
|
emailRequest.setUserId(user.getUserId());
|
||||||
messageRequestRepository.save(emailRequest);
|
messageRequestRepository.save(emailRequest);
|
||||||
@@ -118,7 +114,7 @@ public class MessageSendService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (template.getEnableMessenger().equalsIgnoreCase("Y")) {
|
if (template.getEnableMessenger().equalsIgnoreCase("Y")) {
|
||||||
String swingEaiInterfaceId = portalProperties.get("ums.messenger.if_id");
|
String swingEaiInterfaceId = portalProperties.get("djb.ums.messenger.if_id");
|
||||||
MessageRequest messengerRequest = new MessageRequest();
|
MessageRequest messengerRequest = new MessageRequest();
|
||||||
messengerRequest.setMessageCode(MessageCode.valueOf(template.getMessageCode()));
|
messengerRequest.setMessageCode(MessageCode.valueOf(template.getMessageCode()));
|
||||||
messengerRequest.setSubject(subject);
|
messengerRequest.setSubject(subject);
|
||||||
@@ -128,7 +124,7 @@ public class MessageSendService {
|
|||||||
messengerRequest.setUsername(user.getUsername());
|
messengerRequest.setUsername(user.getUsername());
|
||||||
messengerRequest.setMessengerId(user.getUserId());
|
messengerRequest.setMessengerId(user.getUserId());
|
||||||
messengerRequest.setEaiInterfaceId(swingEaiInterfaceId);
|
messengerRequest.setEaiInterfaceId(swingEaiInterfaceId);
|
||||||
messengerRequest.setServiceId(portalProperties.get("ums.messenger.tx_id"));
|
messengerRequest.setServiceId(portalProperties.get("djb.ums.messenger.tx_id"));
|
||||||
messengerRequest.setMessageType("MESSENGER");
|
messengerRequest.setMessageType("MESSENGER");
|
||||||
messengerRequest.setUserId(user.getUserId());
|
messengerRequest.setUserId(user.getUserId());
|
||||||
messageRequestRepository.save(messengerRequest);
|
messageRequestRepository.save(messengerRequest);
|
||||||
|
|||||||
Reference in New Issue
Block a user