diff --git a/api/price_survey/가격조사수정.http b/api/price_survey/가격조사수정.http index 158e63e..5e3c717 100644 --- a/api/price_survey/가격조사수정.http +++ b/api/price_survey/가격조사수정.http @@ -2,10 +2,10 @@ PUT http://localhost:8010//api/prcs Content-Type: application/json { - "prcsNo": "PRCS-20250521019", + "prcsNo": "PRCS-20250530003", "cateCd": "0200", - "title": "5층 파티션 구매", - "content": "싼거 찾아요111", + "title": "가격조사 결재 테스트", + "content": "시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n", "regSdat": "2025-04-01", "regEdat": "2025-07-30", "prvYn": false, @@ -19,26 +19,23 @@ Content-Type: application/json "apprReqs": [ { "gubunCd": "", - "apprNo": "APPR-20250514013", - "apprOrd": 10, + "apprNo": "APPR-0000000066", "sabun": "psn14020", "name": "조진우", "attendCd": "" }, { "gubunCd": "0100", - "apprNo": "APPR-20250514013", - "apprOrd": 20, + "apprNo": "APPR-0000000066", "sabun": "17131303", - "name": "김진형1", + "name": "김진형", "attendCd": "" }, { "gubunCd": "0200", - "apprNo": "APPR-20250514013", - "apprOrd": 30, + "apprNo": "APPR-0000000066", "sabun": "17131304", - "name": "손원장1", + "name": "손원장", "attendCd": "01" } ], diff --git a/api/price_survey/가격조사저장.http b/api/price_survey/가격조사저장.http index 00fa4ef..4022c83 100644 --- a/api/price_survey/가격조사저장.http +++ b/api/price_survey/가격조사저장.http @@ -3,7 +3,7 @@ Content-Type: application/json { "cateCd": "0100", - "title": "가격조사 시나리오 테스트22", + "title": "가격조사 결재 테스트", "content": "시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n", "regSdat": "2025-04-01", "regEdat": "2025-05-22", @@ -30,25 +30,25 @@ Content-Type: application/json "gubunCd": "", "sabun": "psn14020", "name": "조진우", - "attendCd": null + "attendCd": "" }, { "gubunCd": "0100", "sabun": "psn25226", "name": "김건", - "attendCd": null + "attendCd": "" }, { "gubunCd": "0100", "sabun": "17131303", "name": "김진형", - "attendCd": null + "attendCd": "" }, { "gubunCd": "0200", "sabun": "17131304", "name": "손원장", - "attendCd": null + "attendCd": "" } ], "prcsBizs": [ diff --git a/src/main/java/com/kospo/svcm/dto/res/EstimateDetailResponse.java b/src/main/java/com/kospo/svcm/dto/res/EstimateDetailResponse.java index ad9dd7b..d4ded73 100644 --- a/src/main/java/com/kospo/svcm/dto/res/EstimateDetailResponse.java +++ b/src/main/java/com/kospo/svcm/dto/res/EstimateDetailResponse.java @@ -22,6 +22,10 @@ import java.util.stream.Collectors; public class EstimateDetailResponse implements Serializable { @Schema(name = "estNo", description = "견적관리번호") String estNo; + @Schema(name = "compNm", description = "회사명") + String compNm; + @Schema(name = "repNm", description = "사업자명") + String repNm; @Schema(name = "mngNm", description = "담당자명") String mngNm; @Schema(name = "unitPrc", description = "단가") @@ -40,6 +44,8 @@ public class EstimateDetailResponse implements Serializable { .dtlSpNo(estimate.getDtlSpNo()) .unitPrc(estimate.getUnitPrc()) .amt(estimate.getAmt()) + .compNm(estimate.getBusiness().getCompNm()) + .repNm(estimate.getBusiness().getRepNm()) .regDt(estimate.getRegDt()) .build(); } diff --git a/src/main/java/com/kospo/svcm/dto/res/PrcsBizDetailResponse.java b/src/main/java/com/kospo/svcm/dto/res/PrcsBizDetailResponse.java index 37149d9..7584d26 100644 --- a/src/main/java/com/kospo/svcm/dto/res/PrcsBizDetailResponse.java +++ b/src/main/java/com/kospo/svcm/dto/res/PrcsBizDetailResponse.java @@ -35,6 +35,7 @@ public class PrcsBizDetailResponse implements Serializable { @Schema(name = "totAmt", description = "합계금액") int totAmt; List estimates; + List pbAtts; public static PrcsBizDetailResponse from(PrcsBiz prcsBiz) { return PrcsBizDetailResponse.builder() diff --git a/src/main/java/com/kospo/svcm/dto/res/PrcsDetailResponse.java b/src/main/java/com/kospo/svcm/dto/res/PrcsDetailResponse.java index 580bc9b..26669e3 100644 --- a/src/main/java/com/kospo/svcm/dto/res/PrcsDetailResponse.java +++ b/src/main/java/com/kospo/svcm/dto/res/PrcsDetailResponse.java @@ -1,6 +1,7 @@ package com.kospo.svcm.dto.res; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.kospo.svcm.model.PbAtt; import com.kospo.svcm.model.Prcs; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; diff --git a/src/main/java/com/kospo/svcm/repository/PbAttRepository.java b/src/main/java/com/kospo/svcm/repository/PbAttRepository.java index d8f9f1d..e8961c9 100644 --- a/src/main/java/com/kospo/svcm/repository/PbAttRepository.java +++ b/src/main/java/com/kospo/svcm/repository/PbAttRepository.java @@ -4,5 +4,9 @@ import com.kospo.svcm.model.PbAtt; import com.kospo.svcm.model.PbAttId; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface PbAttRepository extends JpaRepository { + List findByIdPrcsNoAndIdBizNo(String prcsNo, String bizNo); + List findByIdPrcsNo(String prcsNo); } \ No newline at end of file diff --git a/src/main/java/com/kospo/svcm/service/impl/PrcsServiceImpl.java b/src/main/java/com/kospo/svcm/service/impl/PrcsServiceImpl.java index 85be710..7e1803f 100644 --- a/src/main/java/com/kospo/svcm/service/impl/PrcsServiceImpl.java +++ b/src/main/java/com/kospo/svcm/service/impl/PrcsServiceImpl.java @@ -48,6 +48,8 @@ public class PrcsServiceImpl implements PrcsService { private final MailUtils mailUtils; private final SequenceUtils sequenceUtils; private final UserRepository userRepository; + private final BusinessRepository businessRepository; + private final PbAttRepository pbAttRepository; @Value("${server.attach}") private String filePath; @@ -124,11 +126,14 @@ public class PrcsServiceImpl implements PrcsService { List estimates = estimateRepository.findByBizNoAndPrcsNo(prcsBiz.getBizNo(), prcsBiz.getPrcsNo()); int totAmt = estimates.stream().mapToInt(Estimate::getAmt).sum(); prcsBiz.setTotAmt(totAmt); + List pbAttList = pbAttRepository.findByIdPrcsNoAndIdBizNo(prcsNo, prcsBiz.getBizNo()); + prcsBiz.setPbAtts(pbAttList.stream().map(PbAttResponse::from).toList()); prcsBiz.setEstimates(estimates.stream().map(estimate ->{ EstimateDetailResponse estimateDetailResponse = EstimateDetailResponse.from(estimate); return estimateDetailResponse; }).toList()); }); + return prcsResponse; } else { throw new CustomException(ErrorCode.FIND_ERR); @@ -456,44 +461,28 @@ public class PrcsServiceImpl implements PrcsService { List apprReqs = new ArrayList<>(); ApprMst getApprMst = apprMstRepository.findByPrcsNo(prcsRequest.getPrcsNo()); + apprReqRepository.deleteByIdApprNo(getApprMst.getApprNo()); IntStream.range(0, prcsRequest.getApprReqs().size()).forEach(idx -> { PrcsUpdateRequest.ApprReqUpdateRequest apprReqRequest = prcsRequest.getApprReqs().get(idx); User apprUser = userRepository.findById(apprReqRequest.getSabun()).get(); - if (apprReqRequest.getApprNo() != null) { - ApprReq apprReq = apprReqRepository.findById(ApprReqId.builder() - .apprOrd(apprReqRequest.getApprOrd()) - .apprNo(getApprMst.getApprNo()) - .build()).get(); - apprReq.setName(apprReqRequest.getName()); - apprReq.setSabun(apprReqRequest.getSabun()); - apprReq.setAttendCd(apprReqRequest.getAttendCd()); - apprReq.setAttendNm(StringUtil.isBlank(apprReqRequest.getAttendCd()) ? "재중" : CommonUtils.getCodeNm(attendCodes, apprReqRequest.getAttendCd())); - apprReq.setGubunCd(apprReqRequest.getGubunCd()); - apprReq.setGubunNm(StringUtil.isBlank(apprReqRequest.getGubunCd()) ? "입안" : CommonUtils.getCodeNm(gubunCodes, apprReqRequest.getGubunCd())); - apprReq.setDeptCd(apprUser.getDept().getDeptCd()); - apprReq.setDeptNm(apprUser.getDept().getDeptNm()); - apprReqs.add(apprReq); - apprOrd.incrementAndGet(); - } else { - apprReqs.add(ApprReq.builder() - .id(ApprReqId.builder() - .apprNo(getApprMst.getApprNo()) - .apprOrd(apprOrd.incrementAndGet()) - .build()) - .sabun(apprReqRequest.getSabun()) - .name(apprReqRequest.getName()) - .apprDt("") - .apprStatCd(apprCodeCd) - .apprStat(CommonUtils.getCodeNm(apprCodes, apprCodeCd)) - .gubunCd(apprReqRequest.getGubunCd()) - .gubunNm(CommonUtils.getCodeNm(gubunCodes, apprReqRequest.getGubunCd())) - .attendCd(apprReqRequest.getAttendCd()) - .attendNm(CommonUtils.getCodeNm(attendCodes, apprReqRequest.getAttendCd())) - .deptCd(apprUser.getDept().getDeptCd()) - .deptNm(apprUser.getDept().getDeptNm()) - .build()); - } + apprReqs.add(ApprReq.builder() + .id(ApprReqId.builder() + .apprNo(getApprMst.getApprNo()) + .apprOrd(apprOrd.incrementAndGet()) + .build()) + .sabun(apprReqRequest.getSabun()) + .name(apprReqRequest.getName()) + .apprDt("") + .apprStatCd(apprCodeCd) + .apprStat(CommonUtils.getCodeNm(apprCodes, apprCodeCd)) + .gubunCd(apprReqRequest.getGubunCd()) + .gubunNm(CommonUtils.getCodeNm(gubunCodes, apprReqRequest.getGubunCd())) + .attendCd(apprReqRequest.getAttendCd()) + .attendNm(CommonUtils.getCodeNm(attendCodes, apprReqRequest.getAttendCd())) + .deptCd(apprUser.getDept().getDeptCd()) + .deptNm(apprUser.getDept().getDeptNm()) + .build()); }); getApprMst.setApprReqs(apprReqs);