전표 생성 sap 결재 통합

전표 조회 상세 수정 화면 분리
This commit is contained in:
2025-06-02 20:42:34 +09:00
parent cae32f8be7
commit 43c3989323
12 changed files with 470 additions and 100 deletions

View File

@@ -21,5 +21,51 @@ Content-Type: application/json
"kostl": "12330",
"projk": "",
"trtGubun": "11",
"txBillSeq": "202503231"
"txBillSeq": "202503231",
"slipAtts": [
{
"logiFnm": "sapApprTest.pdf",
"data": "4paR4paS4paT4paI4pa6IFdpbmRvd3MgWC1MaXRlIOKXhOKWiOKWk+KWkuKWkQ0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0K4oCiIEN1c3RvbSBXaW5kb3dzIEJ1aWxkcyBkZXNpZ25lZCB0byBCcmVhdGhlIE5ldyBMaWZlIGludG8geW91ciBQQyENCuKAoiBTbWFsbGVyLCBMaWdodGVyLCBGYXN0ZXIgYW5kIE1vcmUgUmVzcG9uc2l2ZS4NCuKAoiBFbmhhbmNlZCBQcml2YWN5LCBBY2Nlc3NpYmlsaXR5IGFuZCBDb250cm9sLg0K4oCiIDEwMCUgQ2xlYW4uIDEwMCUgU2FmZS4gMTAwJSBPcHRpbWl6ZWQuDQrigKIgQXJlIFlvdSBSZWFkeSBUbyBUYWtlIFlvdXIgV2luZG93cyBleHBlcmllbmNlIHRvIHRoZSBOZXh0IExldmVsIT8NCg0KICDimJEgQ09NRSBWSVNJVCBVUyEg4piRDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCuKeoe+4jyBodHRwczovL3dpbmRvd3N4bGl0ZS5jb20NCuKeoe+4jyBodHRwczovL3d3dy55b3V0dWJlLmNvbS9AV2luZG93c1gtTGl0ZQ0K4p6h77iPIGh0dHBzOi8va28tZmkuY29tL3dpbmRvd3N4bGl0ZQ0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQrinaTvuI8gWW91IGNhbiBIZWxwIFN1cHBvcnQgVGhpcyBQcm9qZWN0IGJ5IERvbmF0aW5nIQ0K4p6h77iPIGh0dHBzOi8va28tZmkuY29tL3dpbmRvd3N4bGl0ZQ0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQrinaTvuI8gWW91IENhbiBIZWxwIFN1cHBvcnQgVGhpcyBQcm9qZWN0IGJ5IERpc2FibGluZyBBZCBCbG9ja2Vycw0KYW5kIGNsaWNraW5nIGFkcyB0aGF0IGludGVyZXN0IHlvdSB3aGlsZSB2aXNpdGluZyBvdXIgV2Vic2l0ZSBhbmQgb3VyIFlvdVR1YmUgQ2hhbm5lbCENCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0K4p6h77iPIFRoYW5rIHlvdSBmb3IgeW91ciBzdXBwb3J0LCBhbmQgZm9yIGJlaW5nIGEgcGFydCBvZiBvdXIgY29tbXVuaXR5IQ0K4p6h77iPIFlvdXJzIFRydWx5IC0gRkJDb25hbiAmIFRoZSBXaW5kb3dzIFgtTGl0ZSBUZWFtDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCg=="
}
],
"zwf0011t": {
"wkftx": "결재 테스트 11",
"apprs": [
{
"label": "결재",
"value": [
{
"lineclsf": "Q",
"bname": "15000037",
"abscd": ""
},
{
"lineclsf": "I",
"bname": "15000003",
"abscd": ""
},
{
"lineclsf": "I",
"bname": "15000004",
"abscd": "A"
},
{
"lineclsf": "E",
"bname": "15000037",
"abscd": ""
},
{
"lineclsf": "E",
"bname": "15000062",
"abscd": ""
},
{
"lineclsf": "A",
"bname": "15000005",
"abscd": ""
}
]
}
]
}
}

View File

@@ -102,25 +102,25 @@ public class SapApprController {
// return ResponseEntity.ok(sapService.getDetail(wfkid));
// }
@Operation(summary = "SAP 결재 저장", description = "임시전표 + sap 결재 저장")
@ApiResponses({
@ApiResponse(description = "Success", responseCode = "200",
content = @Content(mediaType = "application/json",
schema = @Schema(oneOf = {PageResponse.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("/sap/appr")
public ResponseEntity save(
@RequestBody Zwf0011tSaveRequest zwf0011tSaveRequest
) {
return ResponseEntity.ok(sapService.save(zwf0011tSaveRequest));
}
// @Operation(summary = "SAP 결재 저장", description = "임시전표 + sap 결재 저장")
// @ApiResponses({
// @ApiResponse(description = "Success", responseCode = "200",
// content = @Content(mediaType = "application/json",
// schema = @Schema(oneOf = {PageResponse.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("/sap/appr")
// public ResponseEntity save(
// @RequestBody Zwf0011tSaveRequest zwf0011tSaveRequest
// ) {
// return ResponseEntity.ok(sapService.save(zwf0011tSaveRequest));
// }
@Operation(summary = "SAP 결재상태 변경", description = "sap 결재상태 변경(결재승인 A, 결재반려 S")
@ApiResponses({

View File

@@ -34,7 +34,7 @@ public class SlipController {
private final SlipService slipService;
@Operation(summary = "전표 상세 조회", description = "임시, 확정 전표 상세 조회")
@Operation(summary = "전표 상세 조회 상태(대금지급전)", description = "임시, 확정 전표 상세 조회")
@ApiResponses({
@ApiResponse(description = "Success", responseCode = "200",
content = @Content(mediaType = "application/json",
@@ -47,7 +47,7 @@ public class SlipController {
content = @Content(mediaType = "application/json", schema = @Schema(oneOf =
{CustomErrorResponse.class })))
})
@GetMapping("/slip/page/{contNo}")
@GetMapping("/slip/{contNo}")
public ResponseEntity findByContNo(
@Parameter(description = "계약번호") @PathVariable("contNo") String contNo,
Principal principal
@@ -55,6 +55,28 @@ public class SlipController {
return ResponseEntity.ok(slipService.findByContNo(contNo));
}
@Operation(summary = "전표 상세 조회 상태(대금지급중)", description = "임시, 확정 전표 상세 조회")
@ApiResponses({
@ApiResponse(description = "Success", responseCode = "200",
content = @Content(mediaType = "application/json",
schema = @Schema(oneOf =
{Pageable.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 })))
})
@GetMapping("/slip/detail/{contNo}")
public ResponseEntity findByDetailContNo(
@Parameter(description = "계약번호") @PathVariable("contNo") String contNo,
Principal principal
) {
return ResponseEntity.ok(slipService.findByDetailContNo(contNo));
}
@Operation(summary = "임시전표 저장", description = "임시전표 (계약중 대상자) 저장")
@ApiResponses({
@ApiResponse(description = "Success", responseCode = "200",

View File

@@ -56,6 +56,7 @@ public class SlipSaveRequest implements Serializable {
@Schema(name = "txBillSeq", description = "전자세금계산서 일련번호")
String txBillSeq;
List<SlipAttSaveRequest> slipAtts;
Zwf0011tSaveRequest zwf0011t;
@Getter
@Setter

View File

@@ -78,6 +78,7 @@ public class SlipResponse implements Serializable {
@Schema(name = "regDt", description = "등록일시")
String regDt;
List<SlipAttResponse> slipAtts;
Zwf0011tResponse zwf0011t;
public static SlipResponse to(Slip slip) {

View File

@@ -17,12 +17,6 @@ public class SlipAtt {
@EmbeddedId
private SlipAttId id;
@MapsId("contNo")
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@OnDelete(action = OnDeleteAction.CASCADE)
@JoinColumn(name = "cont_no", nullable = false)
private Cont contNo;
@Size(max = 100)
@Column(name = "logi_fnm", length = 100)
private String logiFnm;

View File

@@ -77,7 +77,7 @@ public interface ApprReqRepository extends JpaRepository<ApprReq, ApprReqId> {
" cte.appr_stat,\n" +
" cte.num,\n" +
" am.reg_dt as reg_dt,\n" +
" 'SAP' as gubun\n" +
" 'SVCM' as gubun\n" +
" from cte\n" +
" inner join appr_mst am on cte.appr_no = am.appr_no\n" +
" and am.appr_stat_cd in ('0000', '0100')\n" +
@@ -362,7 +362,7 @@ public interface ApprReqRepository extends JpaRepository<ApprReq, ApprReqId> {
" z3.wkfsq1\n" +
" FROM z3_data z3\n" +
" inner join z2_counts z2c \n" +
" WHERE z2c.z2_count = 1) aa\n" +
" on z2c.z2_count = 1) aa\n" +
" WHERE num = 1\n" +
" and bname = :sabun) cc\n" +
" inner join zwf0011t z11 on cc.wkfid = z11.wkfid\n" +
@@ -519,4 +519,25 @@ public interface ApprReqRepository extends JpaRepository<ApprReq, ApprReqId> {
"from cte",
nativeQuery = true)
Page<igtApprDto> igtFindByDeptCd(@Param("deptCd") String deptCd, @Param("title") String title, Pageable pageable);
interface ZwfApprDto {
String getWkfid();
int getWkfsq();
String getLIneclsf();
String getBname();
String getBtext();
String getPosit();
String getWkfst();
String getAbscd();
}
@Query(value = "with cte as (\n" +
" select wkfid, wkfsq, lineclsf, bname, btext, posit, wkfst, abscd\n" +
" from public.zwf0012t\n" +
" union \n" +
" select wkfid, wkfsq, lineclsf, bname, btext, posit, wkfst, abscd\n" +
" from public.zwf0013t\n" +
" order by lineclsf desc\n" +
") select * from cte where wkfid = :wkfid", nativeQuery = true)
List<ZwfApprDto> findByWkfid(@Param("wkfid") String wkfid);
}

View File

@@ -28,4 +28,5 @@ public interface Zwf0011tRepository extends JpaRepository<Zwf0011t, Zwf0011tId>
Page<Zwf0011t> findSearchBySabun(String sabun, String wkfst, String erSdat, String erEdat, Pageable pageable);
Zwf0011t findByIdWkfid(String wkfid);
}

View File

@@ -9,6 +9,5 @@ import java.util.List;
public interface Zwf0013tRepository extends JpaRepository<Zwf0013t, Zwf0013tId> {
List<Zwf0013t> findByIdWkfid(String WkfId);
Zwf0013t findByWkfsqAndIdWkfidAndIdBname(Integer wkfsq, String idWkfid, String idBname);
}

View File

@@ -8,6 +8,9 @@ public interface SlipService {
@Transactional
SlipResponse findByContNo(String contNo);
@Transactional
SlipResponse findByDetailContNo(String contNo);
@Transactional
SlipResponse save(SlipSaveRequest slipSaveRequest);

View File

@@ -3,17 +3,19 @@ package com.kospo.svcm.service.impl;
import com.kospo.svcm.config.exception.ErrorCode;
import com.kospo.svcm.config.utils.CommonUtils;
import com.kospo.svcm.config.utils.FileUtils;
import com.kospo.svcm.config.utils.SequenceUtils;
import com.kospo.svcm.dto.req.SlipSaveRequest;
import com.kospo.svcm.dto.res.SlipAttResponse;
import com.kospo.svcm.dto.req.Zwf0011tSaveRequest;
import com.kospo.svcm.dto.res.SlipResponse;
import com.kospo.svcm.dto.res.Zwf0011tResponse;
import com.kospo.svcm.dto.res.ZwfApprGrpResponse;
import com.kospo.svcm.exception.CustomException;
import com.kospo.svcm.model.*;
import com.kospo.svcm.repository.ContRepository;
import com.kospo.svcm.repository.SlipAttRepository;
import com.kospo.svcm.repository.SlipRepository;
import com.kospo.svcm.repository.*;
import com.kospo.svcm.service.SlipService;
import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
@@ -21,26 +23,75 @@ import org.springframework.stereotype.Service;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@Service
@RequiredArgsConstructor
public class SlipServiceImpl implements SlipService {
private final ApprReqRepository apprReqRepository;
@Value("${server.attach}")
private String filePath;
private final UserRepository userRepository;
private final SlipRepository slipRepository;
private final ContRepository contRepository;
private final SlipAttRepository slipAttRepository;
private final Zwf0011tRepository zwf0011tRepository;
private final Zwf0012tRepository zwf0012tRepository;
private final Zwf0013tRepository zwf0013tRepository;
private final FileUtils fileUtils;
private final SequenceUtils sequenceUtils;
@Transactional
@Override
public SlipResponse findByContNo(String contNo) {
Optional<Slip> optionalSlip = slipRepository.findById(contNo);
if(optionalSlip.isPresent()) {
return SlipResponse.to(optionalSlip.get());
SlipResponse slipResponse = SlipResponse.to(optionalSlip.get());
String obkey = slipResponse.getBelnr() + slipResponse.getGjahr() + "1000";
Zwf0011t zwf0011t = zwf0011tRepository.findByObkey(obkey);
Zwf0011tResponse zwf0011tResponse = Zwf0011tResponse.to(zwf0011t);
List<ApprReqRepository.ZwfApprDto> zwfApprDtos = apprReqRepository.findByWkfid(zwf0011t.getId().getWkfid());
zwf0011tResponse.setApprs(List.of(ZwfApprGrpResponse.builder()
.label("결재")
.value(Collections.singletonList(zwfApprDtos))
.build()));
slipResponse.setZwf0011t(zwf0011tResponse);
return slipResponse;
} else {
throw new CustomException(ErrorCode.FIND_ERR);
}
}
@Transactional
@Override
public SlipResponse findByDetailContNo(String contNo) {
Optional<Slip> optionalSlip = slipRepository.findById(contNo);
if(optionalSlip.isPresent()) {
SlipResponse slipResponse = SlipResponse.to(optionalSlip.get());
String obkey = slipResponse.getBelnr() + slipResponse.getGjahr() + "1000";
Zwf0011t zwf0011t = zwf0011tRepository.findByObkey(obkey);
Zwf0011tResponse zwf0011tResponse = Zwf0011tResponse.to(zwf0011t);
List<ZwfApprGrpResponse> grpResponseList = new ArrayList<>();
grpResponseList.add(ZwfApprGrpResponse.builder()
.label("결재")
.value(Collections.singletonList(zwf0012tRepository.findByIdWkfid((zwf0011t.getId().getWkfid()))))
.build());
List<Zwf0013t> zwf0013ts = zwf0013tRepository.findByIdWkfid(zwf0011t.getId().getWkfid());
int groupIdx = zwf0013ts.stream().mapToInt(z -> z.getGrpid()).max().orElse(0);
for(int i=1; i<=groupIdx; i++) {
int finalI = i;
grpResponseList.add(ZwfApprGrpResponse.builder()
.label("협조")
.value(Collections.singletonList(zwf0013ts.stream().filter(z -> z.getGrpid() == finalI).toList()))
.build());
}
zwf0011tResponse.setApprs(grpResponseList);
slipResponse.setZwf0011t(zwf0011tResponse);
return slipResponse;
} else {
throw new CustomException(ErrorCode.FIND_ERR);
}
@@ -55,72 +106,214 @@ public class SlipServiceImpl implements SlipService {
/* eai fi 전송 성공후 저장*/
/*계약진행중인 대상자*/
Cont cont = contRepository.findByContNoAndContStatCd(slipSaveRequest.getContNo(), "0200");
if(cont != null) {
Slip slip = slipRepository.save(Slip.builder()
.contNo(slipSaveRequest.getContNo())
.bldat(slipSaveRequest.getBldat())
.budat(slipSaveRequest.getBudat())
.waers(slipSaveRequest.getWaers())
.bktxt(slipSaveRequest.getBktxt())
.lifnr(slipSaveRequest.getLifnr())
.wrbtr(slipSaveRequest.getWrbtr())
.mwskz(slipSaveRequest.getMwskz())
.gsber(slipSaveRequest.getGsber())
.bupla(slipSaveRequest.getBupla())
.zterm(slipSaveRequest.getZterm())
.banks(slipSaveRequest.getBanks())
.bankl(slipSaveRequest.getBankl())
.bankn(slipSaveRequest.getBankn())
.hkont(slipSaveRequest.getHkont())
.wrbtrS(slipSaveRequest.getWrbtrS())
.kostl(slipSaveRequest.getKostl())
.projk(slipSaveRequest.getProjk())
.usnam(user.getSabun())
.url("전표 상세 페이지 url 필요 ex) http://svcm.kospo.co.kr/slip/{cont_no}")
.trtGubun(slipSaveRequest.getTrtGubun())
.txBillSeq(slipSaveRequest.getTxBillSeq())
.regSabun(user.getSabun())
.regDt(CommonUtils.dateFormat("yyyy-MM-dd HH:mm:ss"))
.build());
List<SlipAtt> slipAtts = null;
AtomicInteger fileOrd = new AtomicInteger(0);
if (slipSaveRequest.getSlipAtts() != null && slipSaveRequest.getSlipAtts().size() > 0) {
slipAtts = slipAttRepository.saveAll(slipSaveRequest.getSlipAtts().stream().map(att -> {
if(!CommonUtils.checkAllowExt(att.getLogiFnm())) throw new CustomException(ErrorCode.FILE_EXT_UPLOAD_ERROR);
String pNm = CommonUtils.dateFormat("yyyyMMddHHmmssSSS");
fileUtils.fileUpload(filePath + pNm, att.getData());
try {
return SlipAtt.builder()
.id(
SlipAttId.builder()
.fileOrd(fileOrd.incrementAndGet())
.contNo(cont.getContNo())
.build()
)
.logiFnm(att.getLogiFnm())
.physFnm(pNm)
.size((int) Files.size(Path.of(filePath + pNm)))
.path(filePath + pNm)
.build();
} catch (IOException e) {
throw new RuntimeException(e);
}
}).toList());
if(cont == null) throw new CustomException(ErrorCode.SAVE_ERR);
Slip slip = slipRepository.save(Slip.builder()
.contNo(slipSaveRequest.getContNo())
.bldat(slipSaveRequest.getBldat())
.budat(slipSaveRequest.getBudat())
.waers(slipSaveRequest.getWaers())
.bktxt(slipSaveRequest.getBktxt())
.lifnr(slipSaveRequest.getLifnr())
.wrbtr(slipSaveRequest.getWrbtr())
.mwskz(slipSaveRequest.getMwskz())
.gsber(slipSaveRequest.getGsber())
.bupla(slipSaveRequest.getBupla())
.zterm(slipSaveRequest.getZterm())
.banks(slipSaveRequest.getBanks())
.bankl(slipSaveRequest.getBankl())
.bankn(slipSaveRequest.getBankn())
.hkont(slipSaveRequest.getHkont())
.wrbtrS(slipSaveRequest.getWrbtrS())
.kostl(slipSaveRequest.getKostl())
.projk(slipSaveRequest.getProjk())
.usnam(user.getSabun())
.url("전표 상세 페이지 url 필요 ex) http://svcm.kospo.co.kr/slip/{cont_no}")
.trtGubun(slipSaveRequest.getTrtGubun())
.txBillSeq(slipSaveRequest.getTxBillSeq())
.regSabun(user.getSabun())
.regDt(CommonUtils.dateFormat("yyyy-MM-dd HH:mm:ss"))
.build());
List<SlipAtt> slipAtts = null;
AtomicInteger fileOrd = new AtomicInteger(0);
if (slipSaveRequest.getSlipAtts() != null && slipSaveRequest.getSlipAtts().size() > 0) {
slipAtts = slipAttRepository.saveAll(slipSaveRequest.getSlipAtts().stream().map(att -> {
if(!CommonUtils.checkAllowExt(att.getLogiFnm())) throw new CustomException(ErrorCode.FILE_EXT_UPLOAD_ERROR);
String pNm = CommonUtils.dateFormat("yyyyMMddHHmmssSSS");
fileUtils.fileUpload(filePath + pNm, att.getData());
try {
return SlipAtt.builder()
.id(
SlipAttId.builder()
.fileOrd(fileOrd.incrementAndGet())
.contNo(cont.getContNo())
.build()
)
.logiFnm(att.getLogiFnm())
.physFnm(pNm)
.size((int) Files.size(Path.of(filePath + pNm)))
.path(filePath + pNm)
.build();
} catch (IOException e) {
throw new RuntimeException(e);
}
}).toList());
}
slip.setSlipAtts(slipAtts);
/*임시 전표 생성 eai호출영역 start*/
String resultType = "S";
slip.setBukrs("1000");
slip.setBelnr(CommonUtils.dateFormat("MMddHHmmss"));
slip.setGjahr(CommonUtils.dateFormat("yyyy"));
slip.setType(resultType);
/*임시 전표 생성 eai호출영역 end*/
AtomicReference<Zwf0011tResponse> zwf0011tResponse = new AtomicReference<>();
if(resultType.equals("S")) {
Zwf0011tSaveRequest zwf0011tSaveRequest = slipSaveRequest.getZwf0011t();
AtomicReference<String> wkfid = new AtomicReference<>(CommonUtils.getSapNo(sequenceUtils.findSeqAfterUpdate("sap_appr")));
String ernam = user.getSabun();
String erdat = CommonUtils.dateFormat("yyyyMMdd");
String erzet = CommonUtils.dateFormat("HHmmss");
AtomicReference<String> label = new AtomicReference<>("");
if(StringUtil.isBlank(zwf0011tSaveRequest.getWkfid())) {
zwf0011tResponse.set(Zwf0011tResponse.to(zwf0011tRepository.save(Zwf0011t.builder()
.id(Zwf0011tId.builder()
.wkfid(wkfid.get())
.catag("095")
.build())
.obkey(CommonUtils.getEstNo(slip.getBelnr()))
.wkfst("Q")
.wkftx(zwf0011tSaveRequest.getWkftx())
.ernam(ernam)
.erdat(erdat)
.erzet(erzet)
.build())));
} else {
zwf0011tResponse.set(Zwf0011tResponse.to(zwf0011tRepository.findById(Zwf0011tId.builder()
.catag("095")
.wkfid(zwf0011tSaveRequest.getWkfid())
.build()).get()));
}
slip.setSlipAtts(slipAtts);
/*임시 전표 생성 eai호출영역 start*/
slip.setBukrs("1000");
slip.setBelnr(CommonUtils.dateFormat("yyyyMMddHHmmss"));
slip.setGjahr(CommonUtils.dateFormat("yyyy"));
slip.setType("S");
/*임시 전표 생성 eai호출영역 end*/
slipRepository.save(slip);
return SlipResponse.to(slip);
} else {
throw new CustomException(ErrorCode.SAVE_ERR);
List<Object> mergeList = new ArrayList<>();
AtomicInteger sq = new AtomicInteger(1);
zwf0011tSaveRequest.getApprs().stream().forEach(z -> {
label.set(z.getLabel());
if (z.getLabel().equals("결재")) {
AtomicInteger eSq = new AtomicInteger(1);
z.getValue().stream().forEach(zwfAppr -> {
Optional<User> userOptional = userRepository.findById(zwfAppr.getBname());
if (userOptional.isEmpty()) throw new CustomException(ErrorCode.AUTHENTICATION_NOT_SUPPORT);
if (zwfAppr.getLineclsf().equals("E")) {
mergeList.add(zwf0013tRepository.save(Zwf0013t.builder()
.id(Zwf0013tId.builder()
.wkfid(wkfid.get())
.gubun("I")
.bname(userOptional.get().getSabun())
.build())
.lineclsf(zwfAppr.getLineclsf())
.abscd(zwfAppr.getAbscd())
.btext(userOptional.get().getName())
.posit(userOptional.get().getGradeNm())
.deptn(userOptional.get().getPtsnNm())
.wkfst(zwfAppr.getLineclsf().equals("Q") ? "Q" : "I")
.wkfsq(eSq.get())
.ernam(ernam)
.erdat(erdat)
.erzet(erzet)
.wkfsq1(2)
.grpid(eSq.getAndIncrement())
.build()));
} else {
mergeList.add(zwf0012tRepository.save(Zwf0012t.builder()
.id(Zwf0012tId.builder()
.wkfid(wkfid.get())
.wkfsq(sq.getAndIncrement())
.build())
.lineclsf(zwfAppr.getLineclsf())
.abscd(zwfAppr.getAbscd())
.bname(userOptional.get().getSabun())
.btext(userOptional.get().getName())
.posit(userOptional.get().getGradeNm())
.deptn(userOptional.get().getPtsnNm())
.wkfst(zwfAppr.getLineclsf().equals("Q") ? "Q" : "I")
.ernam(ernam)
.erdat(erdat)
.erzet(erzet)
.build()));
}
});
} else if(z.getLabel().equals("협조")) {
wkfid.set(zwf0011tSaveRequest.getWkfid());
AtomicInteger eSq = new AtomicInteger(1);
z.getValue().stream().forEach(zwfAppr -> {
Optional<User> userOptional = userRepository.findById(zwfAppr.getBname());
if (userOptional.isEmpty()) throw new CustomException(ErrorCode.AUTHENTICATION_NOT_SUPPORT);
if(zwfAppr.getLineclsf().equals("Q")) {
/* 협조 결재자 -> 신규 결재 입안자로 변경 */
Optional<Zwf0013t> zwf0013tOptional = zwf0013tRepository.findById(Zwf0013tId.builder()
.wkfid(wkfid.get())
.gubun("I")
.bname(userOptional.get().getSabun())
.build());
if(zwf0013tOptional.isEmpty()) throw new CustomException(ErrorCode.AUTHENTICATION_NOT_SUPPORT);
Zwf0013t zwf0013t = zwf0013tOptional.get();
zwf0013t.setLineclsf(zwfAppr.getLineclsf());
zwf0013t.setErnam(ernam);
zwf0013t.setErdat(erdat);
zwf0013t.setErzet(erzet);
zwf0013t.setAenam(ernam);
zwf0013t.setAedat(erdat);
zwf0013t.setAezet(erzet);
zwf0013t.setWkfst("A");
zwf0013t.setWkfsq(eSq.getAndIncrement());
mergeList.add(zwf0013tRepository.save(zwf0013t));
} else {
mergeList.add(zwf0013tRepository.save(Zwf0013t.builder()
.id(Zwf0013tId.builder()
.wkfid(wkfid.get())
.gubun("I")
.bname(userOptional.get().getSabun())
.build())
.lineclsf(zwfAppr.getLineclsf())
.abscd(zwfAppr.getAbscd())
.btext(userOptional.get().getName())
.posit(userOptional.get().getGradeNm())
.deptn(userOptional.get().getPtsnNm())
.wkfst(zwfAppr.getLineclsf().equals("Q") ? "A" : "I")
.wkfsq(eSq.getAndIncrement())
.ernam(ernam)
.erdat(erdat)
.erzet(erzet)
.wkfsq1(0)
.grpid(zwfAppr.getGrpid())
.build()));
}
});
}
});
zwf0011tResponse.get().setApprs(Arrays.asList(ZwfApprGrpResponse.builder()
.label(label.get())
.value(mergeList)
.build()));
}
slip = slipRepository.save(slip);
SlipResponse slipResponse = SlipResponse.to(slip);
slipResponse.setZwf0011t(zwf0011tResponse.get());
return slipResponse;
}
@Transactional

View File

@@ -0,0 +1,89 @@
jasypt:
encryptor:
key: kospo2025
bean: jasyptEncryptorAES
property:
prefix: ENC(
suffix: )
server:
address: 0.0.0.0
port: 8010
servlet:
encoding:
charset: UTF-8
enabled: true
force: true
session:
timeout: 1800s
attach: 'c:/appl/svcm/attach/'
jetty:
max-http-form-post-size: 100MB
spring:
application:
name: svcm
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
data:
rest:
detection-strategy: annotated
devtools:
livereload:
enabled: true
remote:
restart:
enabled: false
jpa:
show-sql: false
hibernate:
ddl-auto: validate
naming:
physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
open-in-view: false
mvc:
pathmatch:
matching-strategy: ant_path_matcher
mail:
host: smtp.kospo.co.kr
port: 587
username: psn14020
password: kospo2025!
properties:
smtp:
auth: true
timeout: 5000
starttls:
enable: true
datasource:
hikari:
username: ENC(gLQTvX57MBGvHAhEGckIJbVdgG5w1YPO+bZk5+xOvg6DhAIcGcyXib8T605t2Icd)
password: ENC(KpBRMJPNmBe/zi0mPo32beSSXteAaSEp/Kf7dVV3ss8Qi4mS2bJ+P0eFw2Qs15sV)
connection-timeout: 20000
maximum-pool-size: 30
data-source-properties:
cachePrepStmts: true
prepStmtCacheSize: 200
prepStmtCacheSqlLimit: 2048
useServerPrepStmts: true
url: jdbc:log4jdbc:postgresql://hmsn.ink:35432/svcm
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
jwt:
key: 5840f916c19111ee86fcf38ac250f21377907a8ac19111eebab6e7179f8e5c87
springdoc:
packages-to-scan: com.kospo.svcm
api-docs:
path: /api-docs
groups:
enabled: true
swagger-ui:
path: /swagger-ui.html
enabled: true
groups-order: ASC
tags-sorter: alpha
operations-sorter: alpha
display-request-duration: true
doc-expansion: none
cache:
disabled: true
model-and-view-allowed: true