API 빌더패턴 적용

This commit is contained in:
changkyu choi 2024-12-24 18:05:35 +09:00
parent 51516b8d0b
commit e8967aa333
4 changed files with 393 additions and 3 deletions

View File

@ -0,0 +1,130 @@
package com.interplug.qcast.biz.master;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Schema(description = "Api 시공법 목록 조회 요청 객체 빌더")
public class ApiConstructionBuilder {
@Schema(description = "모듈타입코드")
private String moduleTpCd;
@Schema(description = "지붕재코드")
private String roofMatlCd;
@Schema(description = "가대메이커코드")
private String trestleMkrCd;
@Schema(description = "공법코드")
private String constMthdCd;
@Schema(description = "지붕기초코드")
private String roofBaseCd;
@Schema(description = "면조도")
private String illuminationTp;
@Schema(description = "설치높이")
private String instHt;
@Schema(description = "풍속")
private String stdWindSpeed;
@Schema(description = "적설량")
private String stdSnowLd;
@Schema(description = "경사도코드")
private String inclCd;
@Schema(description = "서까래기초코드")
private String raftBaseCd;
@Schema(description = "하제(망둥어)피치")
private int roofPitch;
public ApiConstructionBuilder setModuleTpCd(String moduleTpCd){
this.moduleTpCd = moduleTpCd;
return this;
}
public ApiConstructionBuilder setRoofMatlCd(String roofMatlCd){
this.roofMatlCd = roofMatlCd;
return this;
}
public ApiConstructionBuilder setTrestleMkrCd(String trestleMkrCd){
this.trestleMkrCd = trestleMkrCd;
return this;
}
public ApiConstructionBuilder setConstMthdCd(String constMthdCd){
this.constMthdCd = constMthdCd;
return this;
}
public ApiConstructionBuilder setRoofBaseCd(String roofBaseCd){
this.roofBaseCd = roofBaseCd;
return this;
}
public ApiConstructionBuilder setIlluminationTp(String illuminationTp){
this.illuminationTp = illuminationTp;
return this;
}
public ApiConstructionBuilder setInstHt(String instHt){
this.instHt = instHt;
return this;
}
public ApiConstructionBuilder setStdWindSpeed(String stdWindSpeed){
this.stdWindSpeed = stdWindSpeed;
return this;
}
public ApiConstructionBuilder setStdSnowLd(String stdSnowLd){
this.stdSnowLd = stdSnowLd;
return this;
}
public ApiConstructionBuilder setInclCd(String inclCd){
this.inclCd = inclCd;
return this;
}
public ApiConstructionBuilder setRaftBaseCd(String raftBaseCd){
this.raftBaseCd = raftBaseCd;
return this;
}
public ApiConstructionBuilder setRoofPitch(int roofPitch){
this.roofPitch = roofPitch;
return this;
}
public ApiConstructionBuilder (String moduleTpCd, String roofMatlCd, String trestleMkrCd, String constMthdCd, String roofBaseCd, String illuminationTp,
String instHt, String stdWindSpeed, String stdSnowLd, String inclCd, String raftBaseCd, int roofPitch) {
this.moduleTpCd = moduleTpCd;
this.roofMatlCd = roofMatlCd;
this.trestleMkrCd = trestleMkrCd;
this.constMthdCd = constMthdCd;
this.roofBaseCd = roofBaseCd;
this.illuminationTp = illuminationTp;
this.instHt = instHt;
this.stdWindSpeed = stdWindSpeed;
this.stdSnowLd = stdSnowLd;
this.inclCd = inclCd;
this.raftBaseCd = raftBaseCd;
this.roofPitch = roofPitch;
}
public ApiConstructionBuilder build(){
return new ApiConstructionBuilder(moduleTpCd, roofMatlCd, trestleMkrCd, constMthdCd, roofBaseCd, illuminationTp,
instHt, stdWindSpeed, stdSnowLd, inclCd, raftBaseCd, roofPitch);
}
}

View File

@ -0,0 +1,74 @@
package com.interplug.qcast.biz.master;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Schema(description = "Api 가대 목록 조회 요청 객체 빌더")
public class ApiTrestleBuilder {
@Schema(description = "모듈타입코드")
private String moduleTpCd;
@Schema(description = "지붕재코드")
private String roofMatlCd;
@Schema(description = "서까래기초코드")
private String raftBaseCd;
@Schema(description = "가대메이커코드")
private String trestleMkrCd;
@Schema(description = "공법코드")
private String constMthdCd;
@Schema(description = "지붕기초코드")
private String roofBaseCd;
public ApiTrestleBuilder setModuleTpCd(String moduleTpCd){
this.moduleTpCd = moduleTpCd;
return this;
}
public ApiTrestleBuilder setRoofMatlCdCd(String roofMatlCd){
this.roofMatlCd = roofMatlCd;
return this;
}
public ApiTrestleBuilder setRaftBaseCd(String raftBaseCd){
this.raftBaseCd = raftBaseCd;
return this;
}
public ApiTrestleBuilder setTrestleMkrCd(String trestleMkrCd){
this.trestleMkrCd = trestleMkrCd;
return this;
}
public ApiTrestleBuilder setConstMthdCd(String constMthdCd){
this.constMthdCd = constMthdCd;
return this;
}
public ApiTrestleBuilder setRoofBaseCd(String roofBaseCd){
this.roofBaseCd = roofBaseCd;
return this;
}
public ApiTrestleBuilder (String moduleTpCd, String roofMatlCd, String raftBaseCd, String trestleMkrCd, String constMthdCd, String roofBaseCd) {
this.moduleTpCd = moduleTpCd;
this.roofMatlCd = roofMatlCd;
this.raftBaseCd = raftBaseCd;
this.trestleMkrCd = trestleMkrCd;
this.constMthdCd = constMthdCd;
this.roofBaseCd = roofBaseCd;
}
public ApiTrestleBuilder build(){
return new ApiTrestleBuilder(moduleTpCd, roofMatlCd, raftBaseCd, trestleMkrCd, constMthdCd, roofBaseCd);
}
}

View File

@ -0,0 +1,138 @@
package com.interplug.qcast.biz.master;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Schema(description = "Api 가대 상세 조회 요청 객체 빌더")
public class ApiTrestleDetailBuilder {
@Schema(description = "모듈타입코드")
private String moduleTpCd;
@Schema(description = "지붕재코드")
private String roofMatlCd;
@Schema(description = "가대메이커코드")
private String trestleMkrCd;
@Schema(description = "공법코드")
private String constMthdCd;
@Schema(description = "지붕기초코드")
private String roofBaseCd;
@Schema(description = "면조도")
private String illuminationTp;
@Schema(description = "설치높이")
private String instHt;
@Schema(description = "풍속")
private String stdWindSpeed;
@Schema(description = "적설량")
private String stdSnowLd;
@Schema(description = "경사도코드")
private String inclCd;
@Schema(description = "시공법")
private String constTp;
@Schema(description = "혼합모듈번호")
private int mixMatlNo;
@Schema(description = "하제(망둥어)피치")
private int roofPitch;
public ApiTrestleDetailBuilder setModuleTpCd(String moduleTpCd){
this.moduleTpCd = moduleTpCd;
return this;
}
public ApiTrestleDetailBuilder setRoofMatlCd(String roofMatlCd){
this.roofMatlCd = roofMatlCd;
return this;
}
public ApiTrestleDetailBuilder setTrestleMkrCd(String trestleMkrCd){
this.trestleMkrCd = trestleMkrCd;
return this;
}
public ApiTrestleDetailBuilder setConstMthdCd(String constMthdCd){
this.constMthdCd = constMthdCd;
return this;
}
public ApiTrestleDetailBuilder setRoofBaseCd(String roofBaseCd){
this.roofBaseCd = roofBaseCd;
return this;
}
public ApiTrestleDetailBuilder setIlluminationTp(String illuminationTp){
this.illuminationTp = illuminationTp;
return this;
}
public ApiTrestleDetailBuilder setInstHt(String instHt){
this.instHt = instHt;
return this;
}
public ApiTrestleDetailBuilder setStdWindSpeed(String stdWindSpeed){
this.stdWindSpeed = stdWindSpeed;
return this;
}
public ApiTrestleDetailBuilder setStdSnowLd(String stdSnowLd){
this.stdSnowLd = stdSnowLd;
return this;
}
public ApiTrestleDetailBuilder setInclCd(String inclCd){
this.inclCd = inclCd;
return this;
}
public ApiTrestleDetailBuilder setConstTp(String constTp){
this.constTp = constTp;
return this;
}
public ApiTrestleDetailBuilder setMixMatlNo(int mixMatlNo){
this.mixMatlNo = mixMatlNo;
return this;
}
public ApiTrestleDetailBuilder setRoofPitch(int roofPitch){
this.roofPitch = roofPitch;
return this;
}
public ApiTrestleDetailBuilder (String moduleTpCd, String roofMatlCd, String trestleMkrCd, String constMthdCd, String roofBaseCd, String illuminationTp,
String instHt, String stdWindSpeed, String stdSnowLd, String inclCd, String constTp, int mixMatlNo, int roofPitch) {
this.moduleTpCd = moduleTpCd;
this.roofMatlCd = roofMatlCd;
this.trestleMkrCd = trestleMkrCd;
this.constMthdCd = constMthdCd;
this.roofBaseCd = roofBaseCd;
this.illuminationTp = illuminationTp;
this.instHt = instHt;
this.stdWindSpeed = stdWindSpeed;
this.stdSnowLd = stdSnowLd;
this.inclCd = inclCd;
this.constTp = constTp;
this.mixMatlNo = mixMatlNo;
this.roofPitch = roofPitch;
}
public ApiTrestleDetailBuilder build(){
return new ApiTrestleDetailBuilder(moduleTpCd, roofMatlCd, trestleMkrCd, constMthdCd, roofBaseCd, illuminationTp,
instHt, stdWindSpeed, stdSnowLd, inclCd, constTp, mixMatlNo, roofPitch);
}
}

View File

@ -56,7 +56,16 @@ public class MasterController {
@Parameter(description = "공법코드") @RequestParam(required = false) String constMthdCd,
@Parameter(description = "지붕기초코드") @RequestParam(required = false) String roofBaseCd) {
return masterService.getTrestleList(moduleTpCd,roofMatlCd,raftBaseCd,trestleMkrCd,constMthdCd,roofBaseCd);
ApiTrestleBuilder apiTrestleInfoBuilder = new ApiTrestleBuilder(moduleTpCd, roofMatlCd, raftBaseCd, trestleMkrCd, constMthdCd, roofBaseCd);
ApiTrestleBuilder atb = apiTrestleInfoBuilder
.setModuleTpCd(moduleTpCd)
.setRoofMatlCdCd(roofMatlCd)
.setRaftBaseCd(raftBaseCd)
.setTrestleMkrCd(trestleMkrCd)
.setConstMthdCd(constMthdCd)
.setRoofBaseCd(roofBaseCd)
.build();
return masterService.getTrestleList(atb.getModuleTpCd(),atb.getRoofMatlCd(),atb.getRaftBaseCd(),atb.getTrestleMkrCd(),atb.getConstMthdCd(),atb.getRoofBaseCd());
}
@Operation(description = "시공법 목록 조회한다.")
@ -87,7 +96,26 @@ public class MasterController {
inclCd == null || inclCd.trim().isEmpty()) {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE);
}
return masterService.getConstructionList(moduleTpCd, roofMatlCd, trestleMkrCd, constMthdCd, roofBaseCd, illuminationTp, instHt, stdWindSpeed, stdSnowLd, inclCd, raftBaseCd, roofPitch);
ApiConstructionBuilder apiConstructionBuilder = new ApiConstructionBuilder(moduleTpCd, roofMatlCd, trestleMkrCd, constMthdCd, roofBaseCd, illuminationTp
, instHt, stdWindSpeed, stdSnowLd, inclCd, raftBaseCd, roofPitch);
ApiConstructionBuilder acb = apiConstructionBuilder
.setModuleTpCd(moduleTpCd)
.setRoofMatlCd(roofMatlCd)
.setTrestleMkrCd(trestleMkrCd)
.setConstMthdCd(constMthdCd)
.setRoofBaseCd(roofBaseCd)
.setIlluminationTp(illuminationTp)
.setInstHt(instHt)
.setStdWindSpeed(stdWindSpeed)
.setStdSnowLd(stdSnowLd)
.setInclCd(inclCd)
.setRaftBaseCd(raftBaseCd)
.setRoofPitch(roofPitch)
.build();
return masterService.getConstructionList(acb.getModuleTpCd(), acb.getRoofMatlCd(), acb.getTrestleMkrCd(), acb.getConstMthdCd(), acb.getRoofBaseCd(), acb.getIlluminationTp()
, acb.getInstHt(), acb.getStdWindSpeed(), acb.getStdSnowLd(), acb.getInclCd(), acb.getRaftBaseCd(), acb.getRoofPitch());
}
@Operation(description = "가대 상세 조회한다.")
@ -120,6 +148,26 @@ public class MasterController {
constTp == null || constTp.trim().isEmpty()) {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE);
}
return masterService.getTrestleDetailList(moduleTpCd, roofMatlCd, trestleMkrCd, constMthdCd, roofBaseCd, illuminationTp, instHt, stdWindSpeed, stdSnowLd, inclCd, constTp, mixMatlNo, roofPitch);
ApiTrestleDetailBuilder apiTrestleDetailBuilder = new ApiTrestleDetailBuilder(moduleTpCd, roofMatlCd, trestleMkrCd, constMthdCd, roofBaseCd, illuminationTp
, instHt, stdWindSpeed, stdSnowLd, inclCd, constTp, mixMatlNo, roofPitch);
ApiTrestleDetailBuilder atdb = apiTrestleDetailBuilder
.setModuleTpCd(moduleTpCd)
.setRoofMatlCd(roofMatlCd)
.setTrestleMkrCd(trestleMkrCd)
.setConstMthdCd(constMthdCd)
.setRoofBaseCd(roofBaseCd)
.setIlluminationTp(illuminationTp)
.setInstHt(instHt)
.setStdWindSpeed(stdWindSpeed)
.setStdSnowLd(stdSnowLd)
.setInclCd(inclCd)
.setConstTp(constTp)
.setMixMatlNo(mixMatlNo)
.setRoofPitch(roofPitch)
.build();
return masterService.getTrestleDetailList(atdb.getModuleTpCd(), atdb.getRoofMatlCd(), atdb.getTrestleMkrCd(), atdb.getConstMthdCd(), atdb.getRoofBaseCd(), atdb.getIlluminationTp()
, atdb.getInstHt(), atdb.getStdWindSpeed(), atdb.getStdSnowLd(), atdb.getInclCd(), atdb.getConstTp(), atdb.getMixMatlNo(), atdb.getRoofPitch());
}
}