mirror of
https://git.hmsn.ink/kospo/svcm/api.git
synced 2026-03-19 21:05:06 +09:00
결재 테스트
This commit is contained in:
@@ -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"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -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": [
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public class PrcsBizDetailResponse implements Serializable {
|
||||
@Schema(name = "totAmt", description = "합계금액")
|
||||
int totAmt;
|
||||
List<EstimateDetailResponse> estimates;
|
||||
List<PbAttResponse> pbAtts;
|
||||
|
||||
public static PrcsBizDetailResponse from(PrcsBiz prcsBiz) {
|
||||
return PrcsBizDetailResponse.builder()
|
||||
|
||||
@@ -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.*;
|
||||
|
||||
@@ -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<PbAtt, PbAttId> {
|
||||
List<PbAtt> findByIdPrcsNoAndIdBizNo(String prcsNo, String bizNo);
|
||||
List<PbAtt> findByIdPrcsNo(String prcsNo);
|
||||
}
|
||||
@@ -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<Estimate> estimates = estimateRepository.findByBizNoAndPrcsNo(prcsBiz.getBizNo(), prcsBiz.getPrcsNo());
|
||||
int totAmt = estimates.stream().mapToInt(Estimate::getAmt).sum();
|
||||
prcsBiz.setTotAmt(totAmt);
|
||||
List<PbAtt> 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,26 +461,11 @@ public class PrcsServiceImpl implements PrcsService {
|
||||
List<ApprReq> 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())
|
||||
@@ -493,7 +483,6 @@ public class PrcsServiceImpl implements PrcsService {
|
||||
.deptCd(apprUser.getDept().getDeptCd())
|
||||
.deptNm(apprUser.getDept().getDeptNm())
|
||||
.build());
|
||||
}
|
||||
});
|
||||
|
||||
getApprMst.setApprReqs(apprReqs);
|
||||
|
||||
Reference in New Issue
Block a user