mirror of
https://git.hmsn.ink/kospo/svcm/api.git
synced 2026-03-20 00:32:17 +09:00
전자결재 샘플 데이터 추가
This commit is contained in:
@@ -9,6 +9,7 @@ import com.kospo.svcm.dto.res.ContSaveResponse;
|
||||
import com.kospo.svcm.dto.res.PrcsResponse;
|
||||
import com.kospo.svcm.service.ContService;
|
||||
import com.kospo.svcm.service.PrcsService;
|
||||
import com.kospo.svcm.service.SignDocService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
@@ -32,6 +33,7 @@ import java.security.Principal;
|
||||
public class ContController {
|
||||
private final ContService contService;
|
||||
private final PrcsService prcsService;
|
||||
private final SignDocService signDocService;
|
||||
|
||||
@Operation(summary = "계약관리 - 가격조사 가져오기", description = "계약관리 등록 가격조사 가져오기")
|
||||
@ApiResponses({
|
||||
|
||||
122
src/main/java/com/kospo/svcm/controller/SignDocController.java
Normal file
122
src/main/java/com/kospo/svcm/controller/SignDocController.java
Normal file
@@ -0,0 +1,122 @@
|
||||
package com.kospo.svcm.controller;
|
||||
|
||||
import com.kospo.svcm.config.exception.CustomErrorResponse;
|
||||
import com.kospo.svcm.dto.req.ContSaveRequest;
|
||||
import com.kospo.svcm.dto.req.ContUpdateRequest;
|
||||
import com.kospo.svcm.dto.res.ContDetailResponse;
|
||||
import com.kospo.svcm.dto.res.ContListResponse;
|
||||
import com.kospo.svcm.dto.res.ContSaveResponse;
|
||||
import com.kospo.svcm.dto.res.PrcsResponse;
|
||||
import com.kospo.svcm.service.ContService;
|
||||
import com.kospo.svcm.service.PrcsService;
|
||||
import com.kospo.svcm.service.SignDocService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.security.Principal;
|
||||
|
||||
@Tag(name = "SignDoc Api", description = "전자결재 관리")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api")
|
||||
public class SignDocController {
|
||||
private final ContService contService;
|
||||
private final PrcsService prcsService;
|
||||
private final SignDocService signDocService;
|
||||
|
||||
|
||||
@Operation(summary = "fake 전자결재 저장(테스트용) 결재중 상태", description = "테스트 필히 처음은 여기로 시작해야함")
|
||||
@ApiResponses({
|
||||
@ApiResponse(description = "Success", responseCode = "200",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(oneOf =
|
||||
{String.class}))),
|
||||
@ApiResponse(description = "Not found", responseCode = "404",
|
||||
content = @Content(mediaType = "text/plain", schema = @Schema(oneOf =
|
||||
{String.class}))),
|
||||
@ApiResponse(description = "Internal Error", responseCode = "500",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(oneOf =
|
||||
{CustomErrorResponse.class })))
|
||||
})
|
||||
@PostMapping("/sign/start/{contNo}")
|
||||
public ResponseEntity signStart(
|
||||
@Parameter(description = "계약번호") @PathVariable String contNo
|
||||
) {
|
||||
signDocService.fakeSave(contNo);
|
||||
return ResponseEntity.ok("sucess");
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "fake 전자결재 결재완료 상태 변경", description = "테스트")
|
||||
@ApiResponses({
|
||||
@ApiResponse(description = "Success", responseCode = "200",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(oneOf =
|
||||
{String.class}))),
|
||||
@ApiResponse(description = "Not found", responseCode = "404",
|
||||
content = @Content(mediaType = "text/plain", schema = @Schema(oneOf =
|
||||
{String.class}))),
|
||||
@ApiResponse(description = "Internal Error", responseCode = "500",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(oneOf =
|
||||
{CustomErrorResponse.class })))
|
||||
})
|
||||
@PostMapping("/sign/confirm/{contNo}")
|
||||
public ResponseEntity signEnd(
|
||||
@Parameter(description = "계약번호") @PathVariable String contNo
|
||||
) {
|
||||
signDocService.confirm(contNo);
|
||||
return ResponseEntity.ok("sucess");
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "fake 전자결재 반려 상태 변경", description = "테스트")
|
||||
@ApiResponses({
|
||||
@ApiResponse(description = "Success", responseCode = "200",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(oneOf =
|
||||
{String.class}))),
|
||||
@ApiResponse(description = "Not found", responseCode = "404",
|
||||
content = @Content(mediaType = "text/plain", schema = @Schema(oneOf =
|
||||
{String.class}))),
|
||||
@ApiResponse(description = "Internal Error", responseCode = "500",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(oneOf =
|
||||
{CustomErrorResponse.class })))
|
||||
})
|
||||
@PostMapping("/sign/return/{contNo}")
|
||||
public ResponseEntity signReturn(
|
||||
@Parameter(description = "계약번호") @PathVariable String contNo
|
||||
) {
|
||||
signDocService.docReturn(contNo);
|
||||
return ResponseEntity.ok("sucess");
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "fake 전자결재 회수 상태 변경", description = "테스트")
|
||||
@ApiResponses({
|
||||
@ApiResponse(description = "Success", responseCode = "200",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(oneOf =
|
||||
{String.class}))),
|
||||
@ApiResponse(description = "Not found", responseCode = "404",
|
||||
content = @Content(mediaType = "text/plain", schema = @Schema(oneOf =
|
||||
{String.class}))),
|
||||
@ApiResponse(description = "Internal Error", responseCode = "500",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(oneOf =
|
||||
{CustomErrorResponse.class })))
|
||||
})
|
||||
@PostMapping("/sign/recovery/{contNo}")
|
||||
public ResponseEntity signRecovery(
|
||||
@Parameter(description = "계약번호") @PathVariable String contNo
|
||||
) {
|
||||
signDocService.docReturn(contNo);
|
||||
return ResponseEntity.ok("sucess");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,6 +39,8 @@ public class ContSaveRequest implements Serializable {
|
||||
boolean excYn;
|
||||
@Schema(name = "reason", description = "가격조사 예외사유")
|
||||
String reason;
|
||||
@Schema(name = "cateCd", description = "분야코드")
|
||||
String cateCd;
|
||||
List<ContAttSaveRequest> contAtts;
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -41,6 +41,8 @@ public class ContUpdateRequest implements Serializable {
|
||||
boolean excYn;
|
||||
@Schema(name = "reason", description = "가격조사 예외사유")
|
||||
String reason;
|
||||
@Schema(name = "cateCd", description = "분야코드")
|
||||
String cateCd;
|
||||
List<ContAttUpdateRequest> contAtts;
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -54,8 +54,6 @@ public class ContDetailResponse implements Serializable {
|
||||
String docUrl;
|
||||
@Schema(name = "excYn", description = "가격조사 예외")
|
||||
boolean excYn;
|
||||
@Schema(name = "reason", description = "가격조사 예외사유")
|
||||
String reason;
|
||||
|
||||
List<ContAttResponse> contAtts;
|
||||
|
||||
@@ -63,6 +61,8 @@ public class ContDetailResponse implements Serializable {
|
||||
return ContDetailResponse.builder()
|
||||
.contNo(cont.getContNo())
|
||||
.bizNo(cont.getBizNo())
|
||||
.cateCd(cont.getCateCd())
|
||||
.cateNm(cont.getCateNm())
|
||||
.title(cont.getTitle())
|
||||
.compNm(cont.getCompNm())
|
||||
.signDt(cont.getSignDt())
|
||||
|
||||
@@ -91,9 +91,6 @@ public class SignDocResponse implements Serializable {
|
||||
.writerName(signDoc.getWriterName())
|
||||
.sendDate(signDoc.getSendDate())
|
||||
.docUrl(signDoc.getDocUrl())
|
||||
.recvYn(signDoc.getRecvYn())
|
||||
.recvDate(signDoc.getRecvDate())
|
||||
.recvErrorMsg(signDoc.getRecvErrorMsg())
|
||||
.signLines(signDoc.getSignLines().stream().map(SignLineResponse::from).collect(Collectors.toList()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -69,9 +69,6 @@ public class SignLineResponse implements Serializable {
|
||||
.opinion(signLine.getOpinion())
|
||||
.replaceId(signLine.getReplaceId())
|
||||
.replaceName(signLine.getReplaceName())
|
||||
.recvYn(signLine.getRecvYn())
|
||||
.recvDate(signLine.getRecvDate())
|
||||
.recvErrorMsg(signLine.getRecvErrorMsg())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,14 @@ public class Cont {
|
||||
@Column(name = "reg_dt", length = 25)
|
||||
private String regDt;
|
||||
|
||||
@Size(max = 4)
|
||||
@Column(name = "cate_cd", length = 4)
|
||||
private String cateCd;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "cate_nm", length = 50)
|
||||
private String cateNm;
|
||||
|
||||
@Column(name = "exc_yn",columnDefinition = "CHAR(1)")
|
||||
@Convert(converter = YesNoConverter.class)
|
||||
private Boolean excYn;
|
||||
|
||||
@@ -96,18 +96,6 @@ public class SignDoc {
|
||||
@Column(name = "doc_url", length = 200)
|
||||
private String docUrl;
|
||||
|
||||
@Column(name = "recv_yn", columnDefinition = "CHAR(1)")
|
||||
@Convert(converter = YesNoConverter.class)
|
||||
private Boolean recvYn;
|
||||
|
||||
@Size(max = 25)
|
||||
@Column(name = "recv_date", length = 25)
|
||||
private String recvDate;
|
||||
|
||||
@Size(max = 400)
|
||||
@Column(name = "recv_error_msg", length = 400)
|
||||
private String recvErrorMsg;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "transaction_key")
|
||||
List<SignLine> signLines;
|
||||
|
||||
@@ -63,16 +63,4 @@ public class SignLine {
|
||||
@Column(name = "replace_name", length = 50)
|
||||
private String replaceName;
|
||||
|
||||
@Column(name = "recv_yn", columnDefinition = "CHAR(1)")
|
||||
@Convert(converter = YesNoConverter.class)
|
||||
private Boolean recvYn;
|
||||
|
||||
@Size(max = 25)
|
||||
@Column(name = "recv_date", length = 25)
|
||||
private String recvDate;
|
||||
|
||||
@Size(max = 400)
|
||||
@Column(name = "recv_error_msg", length = 400)
|
||||
private String recvErrorMsg;
|
||||
|
||||
}
|
||||
@@ -8,4 +8,5 @@ import java.util.List;
|
||||
|
||||
public interface ContApprRepository extends JpaRepository<ContAppr, ContApprId> {
|
||||
List<ContAppr> findByIdContNoOrderByIdTransactionKeyDesc(String contNo);
|
||||
ContAppr findByIdContNo(String contNo);
|
||||
}
|
||||
@@ -9,7 +9,9 @@ import org.springframework.data.jpa.repository.Query;
|
||||
import java.util.List;
|
||||
|
||||
public interface ContRepository extends JpaRepository<Cont, String> {
|
||||
Cont findByPrcsNo(String prcsNo);
|
||||
@Query(value = "select c from Cont c" +
|
||||
" where c.prcsNo = :prcsNo and c.contStatCd not in('0600', '0700')")
|
||||
Cont findByPrcsNoActive(String prcsNo);
|
||||
|
||||
Cont findByContNoAndContStatCd(String contNo, String contStatCd);
|
||||
|
||||
|
||||
17
src/main/java/com/kospo/svcm/service/SignDocService.java
Normal file
17
src/main/java/com/kospo/svcm/service/SignDocService.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.kospo.svcm.service;
|
||||
|
||||
import jakarta.transaction.Transactional;
|
||||
|
||||
public interface SignDocService {
|
||||
@Transactional
|
||||
void fakeSave(String contNo);
|
||||
|
||||
@Transactional
|
||||
void confirm(String contNo);
|
||||
|
||||
@Transactional
|
||||
void docReturn(String contNo);
|
||||
|
||||
@Transactional
|
||||
void docRecovery(String contNo);
|
||||
}
|
||||
@@ -54,7 +54,6 @@ public class ContServiceImpl implements ContService {
|
||||
@Override
|
||||
public ContDetailResponse findDetail(String contNo) {
|
||||
Cont cont = contRepository.findById(contNo).get();
|
||||
Prcs prcs = prcsRepository.findById(cont.getPrcsNo()).get();
|
||||
ContDetailResponse contDetailResponse = ContDetailResponse.from(cont);
|
||||
Optional<ContAppr> optionalContAppr = contApprRepository.findByIdContNoOrderByIdTransactionKeyDesc(contNo)
|
||||
.stream().findFirst();
|
||||
@@ -62,8 +61,6 @@ public class ContServiceImpl implements ContService {
|
||||
ContAppr contAppr = optionalContAppr.get();
|
||||
contDetailResponse.setDocUrl(contAppr.getSignDoc().getDocUrl());
|
||||
}
|
||||
contDetailResponse.setCateCd(prcs.getCateCd());
|
||||
contDetailResponse.setCateNm(prcs.getCateNm());
|
||||
|
||||
|
||||
return contDetailResponse;
|
||||
@@ -72,10 +69,16 @@ public class ContServiceImpl implements ContService {
|
||||
@Transactional
|
||||
@Override
|
||||
public ContSaveResponse save(ContSaveRequest contSaveRequest) {
|
||||
Cont cont = contRepository.findByPrcsNo(contSaveRequest.getPrcsNo());
|
||||
if(cont == null) {
|
||||
Cont cont = null;
|
||||
if(!StringUtil.isBlank(contSaveRequest.getPrcsNo())) {
|
||||
cont = contRepository.findByPrcsNoActive(contSaveRequest.getPrcsNo());
|
||||
}
|
||||
if(cont == null || contSaveRequest.isExcYn()) {
|
||||
User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
Prcs prcs = prcsRepository.findByPrcsNoAndRegSabun(contSaveRequest.getPrcsNo(), user.getSabun());
|
||||
Prcs prcs = null;
|
||||
if(!StringUtil.isBlank(contSaveRequest.getPrcsNo())) {
|
||||
prcs = prcsRepository.findByPrcsNoAndRegSabun(contSaveRequest.getPrcsNo(), user.getSabun());
|
||||
}
|
||||
Date now = new Date();
|
||||
|
||||
if(prcs != null) {
|
||||
@@ -97,6 +100,11 @@ public class ContServiceImpl implements ContService {
|
||||
.contNo(contNo)
|
||||
.prcsNo(contSaveRequest.getPrcsNo())
|
||||
.bizNo(contSaveRequest.getBizNo())
|
||||
.cateCd(contSaveRequest.getCateCd())
|
||||
.cateNm(codeRepository.findById(CodeId.builder()
|
||||
.id(5)
|
||||
.cd(contSaveRequest.getCateCd())
|
||||
.build()).get().getNm())
|
||||
.title(contSaveRequest.getTitle())
|
||||
.compNm(contSaveRequest.getCompNm())
|
||||
.signDt(contSaveRequest.getSignDt())
|
||||
@@ -169,6 +177,11 @@ public class ContServiceImpl implements ContService {
|
||||
cont.setTitle(contUpdateRequest.getTitle());
|
||||
cont.setCompNm(contUpdateRequest.getCompNm());
|
||||
cont.setSignDt(contUpdateRequest.getSignDt());
|
||||
cont.setCateCd(contUpdateRequest.getCateCd());
|
||||
cont.setCateNm(codeRepository.findById(CodeId.builder()
|
||||
.id(5)
|
||||
.cd(contUpdateRequest.getCateCd())
|
||||
.build()).get().getNm());
|
||||
cont.setContAmt(contUpdateRequest.getContAmt());
|
||||
cont.setContSdat(contUpdateRequest.getContSdat());
|
||||
cont.setContEdat(contUpdateRequest.getContEdat());
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.kospo.svcm.service.impl;
|
||||
|
||||
import com.kospo.svcm.config.utils.CommonUtils;
|
||||
import com.kospo.svcm.config.utils.SequenceUtils;
|
||||
import com.kospo.svcm.model.*;
|
||||
import com.kospo.svcm.repository.CodeRepository;
|
||||
import com.kospo.svcm.repository.ContApprRepository;
|
||||
import com.kospo.svcm.repository.ContRepository;
|
||||
import com.kospo.svcm.repository.SignDocRepository;
|
||||
import com.kospo.svcm.service.SignDocService;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SignDocServiceImpl implements SignDocService {
|
||||
private final SignDocRepository signDocRepository;
|
||||
private final SequenceUtils sequenceUtils;
|
||||
private final ContApprRepository contApprRepository;
|
||||
private final ContRepository contRepository;
|
||||
private final CodeRepository codeRepository;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void fakeSave(String contNo) {
|
||||
String transactionKey = CommonUtils.getDateNo("SCM", sequenceUtils.findSeqAfterUpdate("sign_no"));
|
||||
contRepository.findById(contNo).ifPresent(cont -> {
|
||||
cont.setContStatCd("0100");
|
||||
cont.setContStat(codeRepository.findById(CodeId.builder()
|
||||
.id(3)
|
||||
.cd("0100")
|
||||
.build()).get().getNm());
|
||||
contRepository.save(cont);
|
||||
});
|
||||
contApprRepository.save(ContAppr.builder()
|
||||
.id(ContApprId.builder()
|
||||
.contNo(contNo)
|
||||
.transactionKey(transactionKey)
|
||||
.build())
|
||||
.build());
|
||||
signDocRepository.save(SignDoc.builder()
|
||||
.transactionKey(transactionKey)
|
||||
.systemGubun("SCM")
|
||||
.writeDate(CommonUtils.dateFormat("yyyyMMddHHmmss"))
|
||||
.title("테스트")
|
||||
.permGrade("전체공개")
|
||||
.deptCode("2099")
|
||||
.deptName("외부지원")
|
||||
.officeCode("0961")
|
||||
.officeName("외부지원")
|
||||
.processStatus("결재중")
|
||||
.processStatusCode("A200")
|
||||
.writerId("psn14020")
|
||||
.writerName("조진우")
|
||||
.sendDate(CommonUtils.dateFormat("yyyyMMddHHmmss"))
|
||||
.docUrl("http://mikep4.kospo.co.kr")
|
||||
.build());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void confirm(String contNo) {
|
||||
ContAppr contAppr = contApprRepository.findByIdContNo(contNo);
|
||||
SignDoc signDoc = contAppr.getSignDoc();
|
||||
|
||||
signDoc.setProcessStatus("결재완료");
|
||||
signDoc.setProcessStatusCode("A900");
|
||||
|
||||
Cont cont = contAppr.getCont();
|
||||
cont.setContStat("0200");
|
||||
cont.setContStat(codeRepository.findById(CodeId.builder()
|
||||
.id(3)
|
||||
.cd("0200")
|
||||
.build()).get().getNm());
|
||||
|
||||
contRepository.save(cont);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void docReturn(String contNo) {
|
||||
ContAppr contAppr = contApprRepository.findByIdContNo(contNo);
|
||||
SignDoc signDoc = contAppr.getSignDoc();
|
||||
|
||||
signDoc.setProcessStatus("반송");
|
||||
signDoc.setProcessStatusCode("A800");
|
||||
|
||||
Cont cont = contAppr.getCont();
|
||||
cont.setContStat("0700");
|
||||
cont.setContStat(codeRepository.findById(CodeId.builder()
|
||||
.id(3)
|
||||
.cd("0700")
|
||||
.build()).get().getNm());
|
||||
|
||||
contRepository.save(cont);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void docRecovery(String contNo) {
|
||||
ContAppr contAppr = contApprRepository.findByIdContNo(contNo);
|
||||
SignDoc signDoc = contAppr.getSignDoc();
|
||||
|
||||
signDoc.setProcessStatus("결재회수");
|
||||
signDoc.setProcessStatusCode("A500");
|
||||
|
||||
Cont cont = contAppr.getCont();
|
||||
cont.setContStat("0200");
|
||||
cont.setContStat(codeRepository.findById(CodeId.builder()
|
||||
.id(3)
|
||||
.cd("0600")
|
||||
.build()).get().getNm());
|
||||
|
||||
contRepository.save(cont);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user