mirror of
https://git.hmsn.ink/kospo/svcm/api.git
synced 2026-03-20 02:32:22 +09:00
결재 테스트
This commit is contained in:
@@ -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,44 +461,28 @@ 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())
|
||||
.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);
|
||||
|
||||
Reference in New Issue
Block a user