mirror of
https://git.hmsn.ink/kospo/svcm/api.git
synced 2026-03-20 03:02:19 +09:00
결재 테스트
This commit is contained in:
@@ -2,10 +2,10 @@ PUT http://localhost:8010//api/prcs
|
|||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
"prcsNo": "PRCS-20250521019",
|
"prcsNo": "PRCS-20250530003",
|
||||||
"cateCd": "0200",
|
"cateCd": "0200",
|
||||||
"title": "5층 파티션 구매",
|
"title": "가격조사 결재 테스트",
|
||||||
"content": "싼거 찾아요111",
|
"content": "시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n",
|
||||||
"regSdat": "2025-04-01",
|
"regSdat": "2025-04-01",
|
||||||
"regEdat": "2025-07-30",
|
"regEdat": "2025-07-30",
|
||||||
"prvYn": false,
|
"prvYn": false,
|
||||||
@@ -19,26 +19,23 @@ Content-Type: application/json
|
|||||||
"apprReqs": [
|
"apprReqs": [
|
||||||
{
|
{
|
||||||
"gubunCd": "",
|
"gubunCd": "",
|
||||||
"apprNo": "APPR-20250514013",
|
"apprNo": "APPR-0000000066",
|
||||||
"apprOrd": 10,
|
|
||||||
"sabun": "psn14020",
|
"sabun": "psn14020",
|
||||||
"name": "조진우",
|
"name": "조진우",
|
||||||
"attendCd": ""
|
"attendCd": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"gubunCd": "0100",
|
"gubunCd": "0100",
|
||||||
"apprNo": "APPR-20250514013",
|
"apprNo": "APPR-0000000066",
|
||||||
"apprOrd": 20,
|
|
||||||
"sabun": "17131303",
|
"sabun": "17131303",
|
||||||
"name": "김진형1",
|
"name": "김진형",
|
||||||
"attendCd": ""
|
"attendCd": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"gubunCd": "0200",
|
"gubunCd": "0200",
|
||||||
"apprNo": "APPR-20250514013",
|
"apprNo": "APPR-0000000066",
|
||||||
"apprOrd": 30,
|
|
||||||
"sabun": "17131304",
|
"sabun": "17131304",
|
||||||
"name": "손원장1",
|
"name": "손원장",
|
||||||
"attendCd": "01"
|
"attendCd": "01"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Content-Type: application/json
|
|||||||
|
|
||||||
{
|
{
|
||||||
"cateCd": "0100",
|
"cateCd": "0100",
|
||||||
"title": "가격조사 시나리오 테스트22",
|
"title": "가격조사 결재 테스트",
|
||||||
"content": "시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n",
|
"content": "시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n시나리오테스트입니다.\n",
|
||||||
"regSdat": "2025-04-01",
|
"regSdat": "2025-04-01",
|
||||||
"regEdat": "2025-05-22",
|
"regEdat": "2025-05-22",
|
||||||
@@ -30,25 +30,25 @@ Content-Type: application/json
|
|||||||
"gubunCd": "",
|
"gubunCd": "",
|
||||||
"sabun": "psn14020",
|
"sabun": "psn14020",
|
||||||
"name": "조진우",
|
"name": "조진우",
|
||||||
"attendCd": null
|
"attendCd": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"gubunCd": "0100",
|
"gubunCd": "0100",
|
||||||
"sabun": "psn25226",
|
"sabun": "psn25226",
|
||||||
"name": "김건",
|
"name": "김건",
|
||||||
"attendCd": null
|
"attendCd": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"gubunCd": "0100",
|
"gubunCd": "0100",
|
||||||
"sabun": "17131303",
|
"sabun": "17131303",
|
||||||
"name": "김진형",
|
"name": "김진형",
|
||||||
"attendCd": null
|
"attendCd": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"gubunCd": "0200",
|
"gubunCd": "0200",
|
||||||
"sabun": "17131304",
|
"sabun": "17131304",
|
||||||
"name": "손원장",
|
"name": "손원장",
|
||||||
"attendCd": null
|
"attendCd": ""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"prcsBizs": [
|
"prcsBizs": [
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ import java.util.stream.Collectors;
|
|||||||
public class EstimateDetailResponse implements Serializable {
|
public class EstimateDetailResponse implements Serializable {
|
||||||
@Schema(name = "estNo", description = "견적관리번호")
|
@Schema(name = "estNo", description = "견적관리번호")
|
||||||
String estNo;
|
String estNo;
|
||||||
|
@Schema(name = "compNm", description = "회사명")
|
||||||
|
String compNm;
|
||||||
|
@Schema(name = "repNm", description = "사업자명")
|
||||||
|
String repNm;
|
||||||
@Schema(name = "mngNm", description = "담당자명")
|
@Schema(name = "mngNm", description = "담당자명")
|
||||||
String mngNm;
|
String mngNm;
|
||||||
@Schema(name = "unitPrc", description = "단가")
|
@Schema(name = "unitPrc", description = "단가")
|
||||||
@@ -40,6 +44,8 @@ public class EstimateDetailResponse implements Serializable {
|
|||||||
.dtlSpNo(estimate.getDtlSpNo())
|
.dtlSpNo(estimate.getDtlSpNo())
|
||||||
.unitPrc(estimate.getUnitPrc())
|
.unitPrc(estimate.getUnitPrc())
|
||||||
.amt(estimate.getAmt())
|
.amt(estimate.getAmt())
|
||||||
|
.compNm(estimate.getBusiness().getCompNm())
|
||||||
|
.repNm(estimate.getBusiness().getRepNm())
|
||||||
.regDt(estimate.getRegDt())
|
.regDt(estimate.getRegDt())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public class PrcsBizDetailResponse implements Serializable {
|
|||||||
@Schema(name = "totAmt", description = "합계금액")
|
@Schema(name = "totAmt", description = "합계금액")
|
||||||
int totAmt;
|
int totAmt;
|
||||||
List<EstimateDetailResponse> estimates;
|
List<EstimateDetailResponse> estimates;
|
||||||
|
List<PbAttResponse> pbAtts;
|
||||||
|
|
||||||
public static PrcsBizDetailResponse from(PrcsBiz prcsBiz) {
|
public static PrcsBizDetailResponse from(PrcsBiz prcsBiz) {
|
||||||
return PrcsBizDetailResponse.builder()
|
return PrcsBizDetailResponse.builder()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.kospo.svcm.dto.res;
|
package com.kospo.svcm.dto.res;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.kospo.svcm.model.PbAtt;
|
||||||
import com.kospo.svcm.model.Prcs;
|
import com.kospo.svcm.model.Prcs;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|||||||
@@ -4,5 +4,9 @@ import com.kospo.svcm.model.PbAtt;
|
|||||||
import com.kospo.svcm.model.PbAttId;
|
import com.kospo.svcm.model.PbAttId;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface PbAttRepository extends JpaRepository<PbAtt, PbAttId> {
|
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 MailUtils mailUtils;
|
||||||
private final SequenceUtils sequenceUtils;
|
private final SequenceUtils sequenceUtils;
|
||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
|
private final BusinessRepository businessRepository;
|
||||||
|
private final PbAttRepository pbAttRepository;
|
||||||
@Value("${server.attach}")
|
@Value("${server.attach}")
|
||||||
private String filePath;
|
private String filePath;
|
||||||
|
|
||||||
@@ -124,11 +126,14 @@ public class PrcsServiceImpl implements PrcsService {
|
|||||||
List<Estimate> estimates = estimateRepository.findByBizNoAndPrcsNo(prcsBiz.getBizNo(), prcsBiz.getPrcsNo());
|
List<Estimate> estimates = estimateRepository.findByBizNoAndPrcsNo(prcsBiz.getBizNo(), prcsBiz.getPrcsNo());
|
||||||
int totAmt = estimates.stream().mapToInt(Estimate::getAmt).sum();
|
int totAmt = estimates.stream().mapToInt(Estimate::getAmt).sum();
|
||||||
prcsBiz.setTotAmt(totAmt);
|
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 ->{
|
prcsBiz.setEstimates(estimates.stream().map(estimate ->{
|
||||||
EstimateDetailResponse estimateDetailResponse = EstimateDetailResponse.from(estimate);
|
EstimateDetailResponse estimateDetailResponse = EstimateDetailResponse.from(estimate);
|
||||||
return estimateDetailResponse;
|
return estimateDetailResponse;
|
||||||
}).toList());
|
}).toList());
|
||||||
});
|
});
|
||||||
|
|
||||||
return prcsResponse;
|
return prcsResponse;
|
||||||
} else {
|
} else {
|
||||||
throw new CustomException(ErrorCode.FIND_ERR);
|
throw new CustomException(ErrorCode.FIND_ERR);
|
||||||
@@ -456,26 +461,11 @@ public class PrcsServiceImpl implements PrcsService {
|
|||||||
List<ApprReq> apprReqs = new ArrayList<>();
|
List<ApprReq> apprReqs = new ArrayList<>();
|
||||||
ApprMst getApprMst = apprMstRepository.findByPrcsNo(prcsRequest.getPrcsNo());
|
ApprMst getApprMst = apprMstRepository.findByPrcsNo(prcsRequest.getPrcsNo());
|
||||||
|
|
||||||
|
apprReqRepository.deleteByIdApprNo(getApprMst.getApprNo());
|
||||||
IntStream.range(0, prcsRequest.getApprReqs().size()).forEach(idx -> {
|
IntStream.range(0, prcsRequest.getApprReqs().size()).forEach(idx -> {
|
||||||
PrcsUpdateRequest.ApprReqUpdateRequest apprReqRequest = prcsRequest.getApprReqs().get(idx);
|
PrcsUpdateRequest.ApprReqUpdateRequest apprReqRequest = prcsRequest.getApprReqs().get(idx);
|
||||||
|
|
||||||
User apprUser = userRepository.findById(apprReqRequest.getSabun()).get();
|
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()
|
apprReqs.add(ApprReq.builder()
|
||||||
.id(ApprReqId.builder()
|
.id(ApprReqId.builder()
|
||||||
.apprNo(getApprMst.getApprNo())
|
.apprNo(getApprMst.getApprNo())
|
||||||
@@ -493,7 +483,6 @@ public class PrcsServiceImpl implements PrcsService {
|
|||||||
.deptCd(apprUser.getDept().getDeptCd())
|
.deptCd(apprUser.getDept().getDeptCd())
|
||||||
.deptNm(apprUser.getDept().getDeptNm())
|
.deptNm(apprUser.getDept().getDeptNm())
|
||||||
.build());
|
.build());
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
getApprMst.setApprReqs(apprReqs);
|
getApprMst.setApprReqs(apprReqs);
|
||||||
|
|||||||
Reference in New Issue
Block a user