260723_02_ENH: 서비스별 발송 내역 및 금액 조회 API 생성

This commit is contained in:
2026-07-23 16:36:26 +09:00
parent 86f9d1b634
commit 209b34720e
13 changed files with 418 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
package com.kri.notihub.server.dto.report;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDate;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "발송 비용 프로젝트별 요약 요청")
public class SendCostSummaryRequestDto {
@Schema(description = "조회 시작 일시")
@NotNull
private LocalDate startDt;
@Schema(description = "조회 종료 일시")
@NotNull
private LocalDate endDt;
}

View File

@@ -0,0 +1,60 @@
package com.kri.notihub.server.dto.report;
import com.kri.notihub.server.common.external.intranet.dto.IntranetProjectBaseInfoDto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "인트라넷 프로젝트 정보 포함 발송 비용 요약")
public class SendCostSummaryWithItrntPrjctDto {
@Schema(description = "요청 서비스")
private String reqstSvc;
@Schema(description = "인트라넷 프로젝트 코드")
private String itrntPrjctCd;
@Schema(description = "발송 타입")
private Short sendTy;
@Schema(description = "발송 업체")
private Short sendCorp;
@Schema(description = "발송 건수")
private Long sendCnt;
@Schema(description = "단가")
private BigDecimal unitPrice;
@Schema(description = "총 비용")
private BigDecimal totalPrice;
@Schema(description = "인트라넷 프로젝트 정보")
private IntranetProjectBaseInfoDto itrntPrjctInfo;
public SendCostSummaryWithItrntPrjctDto(
String reqstSvc,
String itrntPrjctCd,
Short sendTy,
Short sendCorp,
Long sendCnt,
Integer unitPrice
) {
this.reqstSvc = reqstSvc;
this.itrntPrjctCd = itrntPrjctCd;
this.sendTy = sendTy;
this.sendCorp = sendCorp;
this.sendCnt = sendCnt;
this.unitPrice = unitPrice != null ? BigDecimal.valueOf(unitPrice) : BigDecimal.ZERO;
this.totalPrice = this.unitPrice.multiply(BigDecimal.valueOf(sendCnt != null ? sendCnt : 0L));
}
}

View File

@@ -0,0 +1,90 @@
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.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SendCostSummaryWithItrntPrjctExcelDto {
@ExcelColumn(header = "요청 서비스", order = 0)
private String reqstSvc;
@ExcelColumn(header = "인트라넷 프로젝트 코드", order = 1)
private String itrntPrjctCd;
@ExcelColumn(header = "프로젝트 명", order = 2)
private String title;
@ExcelColumn(header = "연구팀 명", order = 3)
private String researchTeamName;
@ExcelColumn(header = "발송 타입", order = 4)
private String sendTy;
@ExcelColumn(header = "발송 업체", order = 5)
private String sendCorp;
@ExcelColumn(header = "발송 건수", order = 6)
private Long sendCnt;
@ExcelColumn(header = "단가", order = 7)
private BigDecimal unitPrice;
@ExcelColumn(header = "총 비용", order = 8)
private BigDecimal totalPrice;
public static SendCostSummaryWithItrntPrjctExcelDto from(
SendCostSummaryWithItrntPrjctDto source) {
if (source == null) {
return null;
}
IntranetProjectBaseInfoDto projectInfo = source.getItrntPrjctInfo();
return SendCostSummaryWithItrntPrjctExcelDto.builder()
.reqstSvc(source.getReqstSvc())
.itrntPrjctCd(source.getItrntPrjctCd())
.title(projectInfo != null ? projectInfo.getTitle() : null)
.researchTeamName(projectInfo != null ? projectInfo.getResearchTeamName() : null)
.sendTy(getSendTypeLabel(source.getSendTy()))
.sendCorp(getSendCorpLabel(source.getSendCorp()))
.sendCnt(source.getSendCnt())
.unitPrice(source.getUnitPrice())
.totalPrice(source.getTotalPrice())
.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();
}
}
}