261102_01_ENH: 알림톡 발신 프로필 목록 조회 추가 및 템플릿 API senderKey 필수 검증 적용

This commit is contained in:
2026-11-09 15:19:21 +09:00
parent e6b9760594
commit 67f17e993d
8 changed files with 280 additions and 74 deletions

View File

@@ -0,0 +1,15 @@
package com.kri.notihub.server.dto.report;
import java.math.BigDecimal;
/**
* 요청 서비스 · 인트라넷 프로젝트 · 발송 타입별 발송 비용 집계 (조회 전용 projection)
*/
public record SendCostByTypeDto(
String reqstSvc,
String itrntPrjctCd,
Short sendTy,
Long sendCnt,
BigDecimal totalPrice
) {
}

View File

@@ -1,5 +1,6 @@
package com.kri.notihub.server.dto.report;
import com.kri.notihub.server.common.enums.SendType;
import com.kri.notihub.server.common.external.intranet.dto.IntranetProjectBaseInfoDto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
@@ -14,7 +15,7 @@ import lombok.Setter;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "인트라넷 프로젝트 정보 포함 발송 비용 요약")
@Schema(description = "인트라넷 프로젝트 정보 포함 발송 비용 요약 (발송 타입별 컬럼)")
public class SendCostSummaryWithItrntPrjctDto {
@Schema(description = "요청 서비스")
@@ -23,38 +24,100 @@ public class SendCostSummaryWithItrntPrjctDto {
@Schema(description = "인트라넷 프로젝트 코드")
private String itrntPrjctCd;
@Schema(description = "발송 타입")
private Short sendTy;
@Schema(description = "EMAIL 발송 건수")
@Builder.Default
private Long emailCnt = 0L;
@Schema(description = "발송 업체")
private Short sendCorp;
@Schema(description = "SMS 발송 건수")
@Builder.Default
private Long smsCnt = 0L;
@Schema(description = "발송 건수")
private Long sendCnt;
@Schema(description = "LMS 발송 건수")
@Builder.Default
private Long lmsCnt = 0L;
@Schema(description = "단가")
private BigDecimal unitPrice;
@Schema(description = "MMS 발송 건수")
@Builder.Default
private Long mmsCnt = 0L;
@Schema(description = "총 비용")
private BigDecimal totalPrice;
@Schema(description = "알림톡 발송 건수")
@Builder.Default
private Long kkoAtCnt = 0L;
@Schema(description = "EMAIL 단가")
@Builder.Default
private BigDecimal emailUnitPrice = BigDecimal.ZERO;
@Schema(description = "SMS 단가")
@Builder.Default
private BigDecimal smsUnitPrice = BigDecimal.ZERO;
@Schema(description = "LMS 단가")
@Builder.Default
private BigDecimal lmsUnitPrice = BigDecimal.ZERO;
@Schema(description = "MMS 단가")
@Builder.Default
private BigDecimal mmsUnitPrice = BigDecimal.ZERO;
@Schema(description = "알림톡 단가")
@Builder.Default
private BigDecimal kkoAtUnitPrice = BigDecimal.ZERO;
@Schema(description = "EMAIL 비용")
@Builder.Default
private BigDecimal emailTotalPrice = BigDecimal.ZERO;
@Schema(description = "SMS 비용")
@Builder.Default
private BigDecimal smsTotalPrice = BigDecimal.ZERO;
@Schema(description = "LMS 비용")
@Builder.Default
private BigDecimal lmsTotalPrice = BigDecimal.ZERO;
@Schema(description = "MMS 비용")
@Builder.Default
private BigDecimal mmsTotalPrice = BigDecimal.ZERO;
@Schema(description = "알림톡 비용")
@Builder.Default
private BigDecimal kkoAtTotalPrice = BigDecimal.ZERO;
@Schema(description = "인트라넷 프로젝트 정보")
private IntranetProjectBaseInfoDto itrntPrjctInfo;
public SendCostSummaryWithItrntPrjctDto(
String reqstSvc,
String itrntPrjctCd,
Short sendTy,
Short sendCorp,
Long sendCnt,
BigDecimal unitPrice
) {
this.reqstSvc = reqstSvc;
this.itrntPrjctCd = itrntPrjctCd;
this.sendTy = sendTy;
this.sendCorp = sendCorp;
this.sendCnt = sendCnt;
this.unitPrice = unitPrice != null ? unitPrice : BigDecimal.ZERO;
this.totalPrice = this.unitPrice.multiply(BigDecimal.valueOf(sendCnt != null ? sendCnt : 0L));
/**
* 발송 타입에 해당하는 건수 · 단가 · 비용 컬럼을 설정한다.
*/
public void applySendType(SendType sendType, long sendCnt, BigDecimal unitPrice,
BigDecimal totalPrice) {
switch (sendType) {
case EMAIL -> {
this.emailCnt = sendCnt;
this.emailUnitPrice = unitPrice;
this.emailTotalPrice = totalPrice;
}
case SMS -> {
this.smsCnt = sendCnt;
this.smsUnitPrice = unitPrice;
this.smsTotalPrice = totalPrice;
}
case LMS -> {
this.lmsCnt = sendCnt;
this.lmsUnitPrice = unitPrice;
this.lmsTotalPrice = totalPrice;
}
case MMS -> {
this.mmsCnt = sendCnt;
this.mmsUnitPrice = unitPrice;
this.mmsTotalPrice = totalPrice;
}
case KKO_AT -> {
this.kkoAtCnt = sendCnt;
this.kkoAtUnitPrice = unitPrice;
this.kkoAtTotalPrice = totalPrice;
}
}
}
}

View File

@@ -1,8 +1,6 @@
package com.kri.notihub.server.dto.report;
import com.kri.common.feature.excel.ExcelColumn;
import com.kri.notihub.server.common.enums.SendCorpType;
import com.kri.notihub.server.common.enums.SendType;
import com.kri.notihub.server.common.external.intranet.dto.IntranetProjectBaseInfoDto;
import java.math.BigDecimal;
import lombok.Builder;
@@ -21,20 +19,50 @@ public record SendCostSummaryWithItrntPrjctExcelDto(
@ExcelColumn(header = "연구팀 명", order = 3)
String researchTeamName,
@ExcelColumn(header = "발송 타입", order = 4)
String sendTy,
@ExcelColumn(header = "EMAIL 건수", order = 4)
Long emailCnt,
@ExcelColumn(header = "발송 업체", order = 5)
String sendCorp,
@ExcelColumn(header = "SMS 건수", order = 5)
Long smsCnt,
@ExcelColumn(header = "발송 건수", order = 6)
Long sendCnt,
@ExcelColumn(header = "LMS 건수", order = 6)
Long lmsCnt,
@ExcelColumn(header = "단가", order = 7)
BigDecimal unitPrice,
@ExcelColumn(header = "MMS 건수", order = 7)
Long mmsCnt,
@ExcelColumn(header = "총 비용", order = 8)
BigDecimal totalPrice
@ExcelColumn(header = "알림톡 건수", order = 8)
Long kkoAtCnt,
@ExcelColumn(header = "EMAIL 단가", order = 9)
BigDecimal emailUnitPrice,
@ExcelColumn(header = "SMS 단가", order = 10)
BigDecimal smsUnitPrice,
@ExcelColumn(header = "LMS 단가", order = 11)
BigDecimal lmsUnitPrice,
@ExcelColumn(header = "MMS 단가", order = 12)
BigDecimal mmsUnitPrice,
@ExcelColumn(header = "알림톡 단가", order = 13)
BigDecimal kkoAtUnitPrice,
@ExcelColumn(header = "EMAIL 비용", order = 14)
BigDecimal emailTotalPrice,
@ExcelColumn(header = "SMS 비용", order = 15)
BigDecimal smsTotalPrice,
@ExcelColumn(header = "LMS 비용", order = 16)
BigDecimal lmsTotalPrice,
@ExcelColumn(header = "MMS 비용", order = 17)
BigDecimal mmsTotalPrice,
@ExcelColumn(header = "알림톡 비용", order = 18)
BigDecimal kkoAtTotalPrice
) {
public static SendCostSummaryWithItrntPrjctExcelDto from(
SendCostSummaryWithItrntPrjctDto source) {
@@ -49,33 +77,21 @@ public record SendCostSummaryWithItrntPrjctExcelDto(
.itrntPrjctCd(source.getItrntPrjctCd())
.title(projectInfo != null ? projectInfo.title() : null)
.researchTeamName(projectInfo != null ? projectInfo.researchTeamName() : null)
.sendTy(getSendTypeLabel(source.getSendTy()))
.sendCorp(getSendCorpLabel(source.getSendCorp()))
.sendCnt(source.getSendCnt())
.unitPrice(source.getUnitPrice())
.totalPrice(source.getTotalPrice())
.emailCnt(source.getEmailCnt())
.smsCnt(source.getSmsCnt())
.lmsCnt(source.getLmsCnt())
.mmsCnt(source.getMmsCnt())
.kkoAtCnt(source.getKkoAtCnt())
.emailUnitPrice(source.getEmailUnitPrice())
.smsUnitPrice(source.getSmsUnitPrice())
.lmsUnitPrice(source.getLmsUnitPrice())
.mmsUnitPrice(source.getMmsUnitPrice())
.kkoAtUnitPrice(source.getKkoAtUnitPrice())
.emailTotalPrice(source.getEmailTotalPrice())
.smsTotalPrice(source.getSmsTotalPrice())
.lmsTotalPrice(source.getLmsTotalPrice())
.mmsTotalPrice(source.getMmsTotalPrice())
.kkoAtTotalPrice(source.getKkoAtTotalPrice())
.build();
}
private static String getSendTypeLabel(Short code) {
if (code == null) {
return null;
}
try {
return SendType.fromCode(code).name();
} catch (IllegalArgumentException e) {
return code.toString();
}
}
private static String getSendCorpLabel(Short code) {
if (code == null) {
return null;
}
try {
return SendCorpType.fromCode(code).name();
} catch (IllegalArgumentException e) {
return code.toString();
}
}
}