mirror of
https://git.hmsn.ink/kospo/svcm/api.git
synced 2026-03-20 00:32:17 +09:00
오류 개선
This commit is contained in:
@@ -7,6 +7,7 @@ import com.kospo.svcm.dto.res.PageResponse;
|
|||||||
import com.kospo.svcm.dto.res.Zwf0011tResponse;
|
import com.kospo.svcm.dto.res.Zwf0011tResponse;
|
||||||
import com.kospo.svcm.service.SapService;
|
import com.kospo.svcm.service.SapService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
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.ArraySchema;
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -135,6 +136,26 @@ public class SapApprController {
|
|||||||
) {
|
) {
|
||||||
return ResponseEntity.ok(sapService.approve(zwfApprApprovalRequest));
|
return ResponseEntity.ok(sapService.approve(zwfApprApprovalRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "SAP 결재번호로 계약번호 변경", description = "SAP결재번호 TO 계약번호")
|
||||||
|
@ApiResponses({
|
||||||
|
@ApiResponse(description = "Success", responseCode = "200",
|
||||||
|
content = @Content(mediaType = "application/json", array = @ArraySchema(
|
||||||
|
schema = @Schema(oneOf = {Zwf0011tResponse.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 })))
|
||||||
|
})
|
||||||
|
@PutMapping("/sap/appr/converter/{apprNo}")
|
||||||
|
public ResponseEntity converter(
|
||||||
|
@Parameter(description = "sap 결재번호") @PathVariable("apprNo") String apprNo
|
||||||
|
) {
|
||||||
|
return ResponseEntity.ok(sapService.apprNoToContNo(apprNo));
|
||||||
|
}
|
||||||
// @Operation(summary = "본인 결재목록 조회", description = "가격조사 결재 조회")
|
// @Operation(summary = "본인 결재목록 조회", description = "가격조사 결재 조회")
|
||||||
// @ApiResponses({
|
// @ApiResponses({
|
||||||
// @ApiResponse(description = "Success", responseCode = "200",
|
// @ApiResponse(description = "Success", responseCode = "200",
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ public class SlipResponse implements Serializable {
|
|||||||
String regSabun;
|
String regSabun;
|
||||||
@Schema(name = "regDt", description = "등록일시")
|
@Schema(name = "regDt", description = "등록일시")
|
||||||
String regDt;
|
String regDt;
|
||||||
|
@Schema(name = "compNm", description = "업체명")
|
||||||
|
String compNm;
|
||||||
List<SlipAttResponse> slipAtts;
|
List<SlipAttResponse> slipAtts;
|
||||||
Zwf0011tResponse zwf0011t;
|
Zwf0011tResponse zwf0011t;
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public interface ApprReqRepository extends JpaRepository<ApprReq, ApprReqId> {
|
|||||||
" cc.wkfst,\n" +
|
" cc.wkfst,\n" +
|
||||||
" '결재대기',\n" +
|
" '결재대기',\n" +
|
||||||
" cc.num,\n" +
|
" cc.num,\n" +
|
||||||
" to_char(to_date(cc.erdat || cc.erzet, 'yyyymmddHH24miss'), 'yyyy-mm-dd HH24:mi:ss') as erdt,\n" +
|
" to_char(to_timestamp(cc.erdat || cc.erzet, 'yyyymmddHH24miss'), 'yyyy-mm-dd HH24:mi:ss') as erdt,\n" +
|
||||||
" 'SAP'\n" +
|
" 'SAP'\n" +
|
||||||
" from (WITH z2_counts AS (SELECT wkfid,\n" +
|
" from (WITH z2_counts AS (SELECT wkfid,\n" +
|
||||||
" sum(case when wkfst = 'A' then 1 else 0 end)\n" +
|
" sum(case when wkfst = 'A' then 1 else 0 end)\n" +
|
||||||
@@ -257,7 +257,7 @@ public interface ApprReqRepository extends JpaRepository<ApprReq, ApprReqId> {
|
|||||||
" cc.wkfst,\n" +
|
" cc.wkfst,\n" +
|
||||||
" '결재대기',\n" +
|
" '결재대기',\n" +
|
||||||
" cc.num,\n" +
|
" cc.num,\n" +
|
||||||
" to_char(to_date(cc.erdat || cc.erzet, 'yyyymmddHH24miss'), 'yyyy-mm-dd HH24:mi:ss') as erdt,\n" +
|
" to_char(to_timestamp(cc.erdat || cc.erzet, 'yyyymmddHH24miss'), 'yyyy-mm-dd HH24:mi:ss') as erdt,\n" +
|
||||||
" 'SAP'\n" +
|
" 'SAP'\n" +
|
||||||
" from (WITH z2_counts AS (SELECT wkfid,\n" +
|
" from (WITH z2_counts AS (SELECT wkfid,\n" +
|
||||||
" sum(case when wkfst = 'A' then 1 else 0 end)\n" +
|
" sum(case when wkfst = 'A' then 1 else 0 end)\n" +
|
||||||
@@ -536,20 +536,28 @@ public interface ApprReqRepository extends JpaRepository<ApprReq, ApprReqId> {
|
|||||||
interface ZwfApprDto {
|
interface ZwfApprDto {
|
||||||
String getWkfid();
|
String getWkfid();
|
||||||
int getWkfsq();
|
int getWkfsq();
|
||||||
String getLIneclsf();
|
String getLineclsf();
|
||||||
|
String getLineclsfnm();
|
||||||
String getBname();
|
String getBname();
|
||||||
String getBtext();
|
String getBtext();
|
||||||
String getPosit();
|
String getPosit();
|
||||||
String getWkfst();
|
String getWkfst();
|
||||||
String getAbscd();
|
String getAbscd();
|
||||||
}
|
}
|
||||||
@Query(value = "with cte as (\n" +
|
@Query(value = "\n" +
|
||||||
|
"with cte as (\n" +
|
||||||
" select wkfid, wkfsq, lineclsf, bname, btext, posit, wkfst, abscd\n" +
|
" select wkfid, wkfsq, lineclsf, bname, btext, posit, wkfst, abscd\n" +
|
||||||
" from public.zwf0012t\n" +
|
" from public.zwf0012t\n" +
|
||||||
" union \n" +
|
" union \n" +
|
||||||
" select wkfid, wkfsq, lineclsf, bname, btext, posit, wkfst, abscd\n" +
|
" select wkfid, wkfsq, lineclsf, bname, btext, posit, wkfst, abscd\n" +
|
||||||
" from public.zwf0013t\n" +
|
" from public.zwf0013t\n" +
|
||||||
" order by lineclsf desc\n" +
|
" order by lineclsf desc\n" +
|
||||||
") select * from cte where wkfid = :wkfid order by lineclsf desc ", nativeQuery = true)
|
"),\n" +
|
||||||
|
" cod as (\n" +
|
||||||
|
" select * from code where id = '9'\n" +
|
||||||
|
" )\n" +
|
||||||
|
"select\n" +
|
||||||
|
" wkfid, wkfsq, lineclsf, (select nm from cod where cd = cte.lineclsf) as lineclsfnm, bname, btext, posit, wkfst, abscd\n" +
|
||||||
|
" from cte where wkfid = :wkfid order by lineclsf desc ", nativeQuery = true)
|
||||||
List<ZwfApprDto> findByWkfid(@Param("wkfid") String wkfid);
|
List<ZwfApprDto> findByWkfid(@Param("wkfid") String wkfid);
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,20 @@ public interface Zwf0012tRepository extends JpaRepository<Zwf0012t, Zwf0012tId>
|
|||||||
List<Zwf0012t> findByIdWkfidOrderByLineclsfDesc(String WkfId);
|
List<Zwf0012t> findByIdWkfidOrderByLineclsfDesc(String WkfId);
|
||||||
Zwf0012t findByIdWkfidAndIdWkfsqAndBname(String wkfid, Integer wkfsq, String bname);
|
Zwf0012t findByIdWkfidAndIdWkfsqAndBname(String wkfid, Integer wkfsq, String bname);
|
||||||
|
|
||||||
|
@Query(value = "\n" +
|
||||||
|
"with cte as (\n" +
|
||||||
|
" select wkfid, wkfsq, lineclsf, bname, btext, posit, wkfst, abscd\n" +
|
||||||
|
" from public.zwf0012t\n" +
|
||||||
|
" order by lineclsf desc\n" +
|
||||||
|
"),\n" +
|
||||||
|
" cod as (\n" +
|
||||||
|
" select * from code where id = '9'\n" +
|
||||||
|
" )\n" +
|
||||||
|
"select\n" +
|
||||||
|
" wkfid, wkfsq, lineclsf, (select nm from cod where cd = cte.lineclsf) as lineclsfnm, bname, btext, posit, wkfst, abscd\n" +
|
||||||
|
" from cte where wkfid = :wkfid order by lineclsf desc ", nativeQuery = true)
|
||||||
|
List<ApprReqRepository.ZwfApprDto> findByWkfid(@Param("wkfid") String wkfid);
|
||||||
|
|
||||||
interface SapApprReqDto {
|
interface SapApprReqDto {
|
||||||
String getWkfid();
|
String getWkfid();
|
||||||
String getWkftx();
|
String getWkftx();
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.kospo.svcm.repository;
|
|||||||
import com.kospo.svcm.model.Zwf0013t;
|
import com.kospo.svcm.model.Zwf0013t;
|
||||||
import com.kospo.svcm.model.Zwf0013tId;
|
import com.kospo.svcm.model.Zwf0013tId;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -12,4 +14,18 @@ public interface Zwf0013tRepository extends JpaRepository<Zwf0013t, Zwf0013tId>
|
|||||||
Zwf0013t findByWkfsqAndIdWkfidAndIdBname(Integer wkfsq, String idWkfid, String idBname);
|
Zwf0013t findByWkfsqAndIdWkfidAndIdBname(Integer wkfsq, String idWkfid, String idBname);
|
||||||
|
|
||||||
void deleteByIdWkfid(String wkfid);
|
void deleteByIdWkfid(String wkfid);
|
||||||
|
|
||||||
|
@Query(value = "\n" +
|
||||||
|
"with cte as (\n" +
|
||||||
|
" select wkfid, wkfsq, lineclsf, bname, btext, posit, wkfst, abscd\n" +
|
||||||
|
" from public.zwf0013t\n" +
|
||||||
|
" order by lineclsf desc\n" +
|
||||||
|
"),\n" +
|
||||||
|
" cod as (\n" +
|
||||||
|
" select * from code where id = '9'\n" +
|
||||||
|
" )\n" +
|
||||||
|
"select\n" +
|
||||||
|
" wkfid, wkfsq, lineclsf, (select nm from cod where cd = cte.lineclsf) as lineclsfnm, bname, btext, posit, wkfst, abscd\n" +
|
||||||
|
" from cte where wkfid = :wkfid order by lineclsf desc ", nativeQuery = true)
|
||||||
|
List<ApprReqRepository.ZwfApprDto> findByWkfid(@Param("wkfid") String wkfid);
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@ import com.kospo.svcm.dto.res.ZwfApprResponse;
|
|||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface SapService {
|
public interface SapService {
|
||||||
@@ -23,4 +24,7 @@ public interface SapService {
|
|||||||
Zwf0011tResponse save(Zwf0011tSaveRequest zwf0011tSaveRequest);
|
Zwf0011tResponse save(Zwf0011tSaveRequest zwf0011tSaveRequest);
|
||||||
|
|
||||||
List<ZwfApprResponse> approve(ZwfApprApprovalRequest zwfApprApprovalRequest);
|
List<ZwfApprResponse> approve(ZwfApprApprovalRequest zwfApprApprovalRequest);
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
HashMap apprNoToContNo(String apprNo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,7 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -381,4 +378,15 @@ public class SapServiceImpl implements SapService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public HashMap apprNoToContNo(String apprNo) {
|
||||||
|
Zwf0011t zwf0011t = zwf0011tRepository.findByIdWkfid(apprNo);
|
||||||
|
String belnr = zwf0011t.getObkey().substring(0, 10);
|
||||||
|
Slip slip = slipRepository.findByBelnr(belnr);
|
||||||
|
|
||||||
|
HashMap map = new HashMap();
|
||||||
|
map.put("contNo", slip.getContNo());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ public class SlipServiceImpl implements SlipService {
|
|||||||
.value(zwfApprDtos)
|
.value(zwfApprDtos)
|
||||||
.build()));
|
.build()));
|
||||||
slipResponse.setZwf0011t(zwf0011tResponse);
|
slipResponse.setZwf0011t(zwf0011tResponse);
|
||||||
|
Cont cont = contRepository.findById(contNo).get();
|
||||||
|
slipResponse.setCompNm(cont.getCompNm());
|
||||||
return slipResponse;
|
return slipResponse;
|
||||||
} else {
|
} else {
|
||||||
throw new CustomException(ErrorCode.FIND_ERR);
|
throw new CustomException(ErrorCode.FIND_ERR);
|
||||||
@@ -72,6 +74,7 @@ public class SlipServiceImpl implements SlipService {
|
|||||||
public SlipResponse findByDetailContNo(String contNo) {
|
public SlipResponse findByDetailContNo(String contNo) {
|
||||||
Optional<Slip> optionalSlip = slipRepository.findById(contNo);
|
Optional<Slip> optionalSlip = slipRepository.findById(contNo);
|
||||||
if(optionalSlip.isPresent()) {
|
if(optionalSlip.isPresent()) {
|
||||||
|
List<Code> codes = codeRepository.findByIdId(9);
|
||||||
SlipResponse slipResponse = SlipResponse.to(optionalSlip.get());
|
SlipResponse slipResponse = SlipResponse.to(optionalSlip.get());
|
||||||
String obkey = slipResponse.getBelnr() + slipResponse.getGjahr() + "1000";
|
String obkey = slipResponse.getBelnr() + slipResponse.getGjahr() + "1000";
|
||||||
Zwf0011t zwf0011t = zwf0011tRepository.findByObkey(obkey);
|
Zwf0011t zwf0011t = zwf0011tRepository.findByObkey(obkey);
|
||||||
@@ -80,7 +83,7 @@ public class SlipServiceImpl implements SlipService {
|
|||||||
List<ZwfApprGrpResponse> grpResponseList = new ArrayList<>();
|
List<ZwfApprGrpResponse> grpResponseList = new ArrayList<>();
|
||||||
grpResponseList.add(ZwfApprGrpResponse.builder()
|
grpResponseList.add(ZwfApprGrpResponse.builder()
|
||||||
.label("결재")
|
.label("결재")
|
||||||
.value(zwf0012tRepository.findByIdWkfidOrderByLineclsfDesc((zwf0011t.getId().getWkfid())))
|
.value(zwf0012tRepository.findByWkfid((zwf0011t.getId().getWkfid())))
|
||||||
.build());
|
.build());
|
||||||
List<Zwf0013t> zwf0013ts = zwf0013tRepository.findByIdWkfidOrderByLineclsfDesc(zwf0011t.getId().getWkfid());
|
List<Zwf0013t> zwf0013ts = zwf0013tRepository.findByIdWkfidOrderByLineclsfDesc(zwf0011t.getId().getWkfid());
|
||||||
int groupIdx = zwf0013ts.stream().mapToInt(z -> z.getGrpid()).max().orElse(0);
|
int groupIdx = zwf0013ts.stream().mapToInt(z -> z.getGrpid()).max().orElse(0);
|
||||||
@@ -94,6 +97,9 @@ public class SlipServiceImpl implements SlipService {
|
|||||||
|
|
||||||
zwf0011tResponse.setApprs(grpResponseList);
|
zwf0011tResponse.setApprs(grpResponseList);
|
||||||
slipResponse.setZwf0011t(zwf0011tResponse);
|
slipResponse.setZwf0011t(zwf0011tResponse);
|
||||||
|
Cont cont = contRepository.findById(contNo).get();
|
||||||
|
slipResponse.setCompNm(cont.getCompNm());
|
||||||
|
|
||||||
return slipResponse;
|
return slipResponse;
|
||||||
} else {
|
} else {
|
||||||
throw new CustomException(ErrorCode.FIND_ERR);
|
throw new CustomException(ErrorCode.FIND_ERR);
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: local
|
active: dev
|
||||||
Reference in New Issue
Block a user