fix: 폐기보고 서버 호출로 변경

dev
Jonguk. Lim 4 months ago
parent aaf7931812
commit 273e104268

@ -1,6 +1,7 @@
package cokr.xit.adds.cmm.model; package cokr.xit.adds.cmm.model;
import java.net.http.HttpResponse; import java.net.http.HttpResponse;
import java.util.List;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -39,6 +40,7 @@ public class ApiUtil {
request.contentType(WebClient.Request.ContentType.FORM); request.contentType(WebClient.Request.ContentType.FORM);
request.uri(uri); request.uri(uri);
toData(request, cls); toData(request, cls);
System.out.println("request : " + request);
}); });
return rslt.body(); return rslt.body();
} }
@ -68,8 +70,15 @@ public class ApiUtil {
JSONObject jsonObj = toObjByObj(obj, JSONObject.class); JSONObject jsonObj = toObjByObj(obj, JSONObject.class);
for (Object key : jsonObj.keySet()) { for (Object key : jsonObj.keySet()) {
// API 호출 시 필요없는 파라메터 제외 Object value = jsonObj.get(key);
request.data((String) key, ObjectUtils.isEmpty(jsonObj.get(key))? StringUtils.EMPTY: jsonObj.get(key));
if (value instanceof List) {
// List를 쉼표로 구분된 문자열로 변환
String listAsString = String.join(",", (List<String>) value);
request.data((String) key, listAsString);
} else {
request.data((String) key, ObjectUtils.isEmpty(value) ? StringUtils.EMPTY : value.toString());
}
} }
} }

@ -1,5 +1,7 @@
package cokr.xit.adds.cmm.model; package cokr.xit.adds.cmm.model;
import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import lombok.Data; import lombok.Data;
@ -363,4 +365,15 @@ public class NimsApiRequest {
*/ */
private String userId; private String userId;
} }
@Data
public static class DsuseMgtInqReq {
private List<String> dscdmngIds;
private String adds12;
private String userId;
}
} }

@ -78,6 +78,9 @@ public class AddsNimsController extends ApplicationController {
@Value("${app.inf.nims.api.prdMnfSeqInfoOfBarcode}") @Value("${app.inf.nims.api.prdMnfSeqInfoOfBarcode}")
private String prdMnfSeqInfoOfBarcodeEndpoint; private String prdMnfSeqInfoOfBarcodeEndpoint;
@Value("${app.inf.nims.api.dsuseMgtListForRptDoc}")
private String dsuseMgtListForRptDocEndpoint;
@Resource(name="sigunguDepartmentService") @Resource(name="sigunguDepartmentService")
private SigunguDepartmentService sggDeptService; private SigunguDepartmentService sggDeptService;
@ -621,4 +624,59 @@ public class AddsNimsController extends ApplicationController {
String rslt = ApiUtil.callNimsApi(apiHost + productAndseqInfoEndpoint, dto); String rslt = ApiUtil.callNimsApi(apiHost + productAndseqInfoEndpoint, dto);
return json.parse(rslt, new TypeReference<>() {}); return json.parse(rslt, new TypeReference<>() {});
} }
@RequestMapping(value = "/getDsuseMgtListForRptDoc.do", name="보고문서 출력 상세 목록 조회", produces = "application/json;charset=UTF-8")
public @ResponseBody ApiBaseResponse<List<JSONObject>> getDsuseMgtListForRptDoc(@ModelAttribute NimsApiRequest.DsuseMgtInqReq dto) {
String rslt = ApiUtil.callNimsApi(apiHost + dsuseMgtListForRptDocEndpoint, dto);
ApiBaseResponse<List<JSONObject>> parse = json.parse(rslt, new TypeReference<>() {});
return parse;
}
} }
/*
for(let dsuseMgtMaster of respData){
dsuseMgtMaster.dsuseMgtDtls.map((dtl) => {
keys = Object.keys(dsuseMgtMaster);
for(let key of keys){
if(key == "dsuseMgtDtls"){
continue;
}
if(key == "bsshNm" || key == "bsshCd"){
dtl[key+"0"] = dsuseMgtMaster[key];
} else if(dtl[key] == undefined){
dtl[key] = dsuseMgtMaster[key];
}
}
return dtl;
});
}
let dtls = [];
for(let i=0; i < respData.length; i++){
dtls = dtls.concat(respData[i].dsuseMgtDtls);
}
let url = "";
if(ADDS12 == "01"){
url = wctx.url("/adds/nims/makeDisposeResultReportHwp.do");
} else if(ADDS12 == "02"){
url = wctx.url("/adds/nims/makeDisposeProcessDetailsHwp.do");
} else {
return;
}
*/

@ -1,7 +1,7 @@
server: server:
shutdown: graceful shutdown: graceful
port: 9077 port: 9077
max-http-header-size: 100KB max-http-header-size: 48KB
servlet: servlet:
context-path: / context-path: /
@ -68,9 +68,10 @@ app:
jurisdictionGovInfo: /api/biz/nims/v1/getNimsJurisdictionGovInfo jurisdictionGovInfo: /api/biz/nims/v1/getNimsJurisdictionGovInfo
# 폐기보고 조회 # 폐기보고 조회
nimsDsuseRptInfo: /api/biz/nims/v1/getNimsDsuseRptInfo nimsDsuseRptInfo: /api/biz/nims/v1/getNimsDsuseRptInfo
# 바코드 조회
prdMnfSeqInfoOfBarcode: /api/biz/nims/v1/getPrdMnfSeqInfoOfBarcode prdMnfSeqInfoOfBarcode: /api/biz/nims/v1/getPrdMnfSeqInfoOfBarcode
# 보고문서 정보 목록 조회
dsuseMgtListForRptDoc: /api/biz/nims/v1/getDsuseMgtListForRptDoc
logging: logging:
file: file:

@ -374,16 +374,16 @@
alert("체크된 자료가 없습니다."); alert("체크된 자료가 없습니다.");
return; return;
} }
ajax.post({ ajax.get({
url: '<c:url value="${apiHost}/api/biz/nims/v1/getDsuseMgtListForRptDoc" />', url: wctx.url("/adds/nims/getDsuseMgtListForRptDoc.do"),
contentType : "application/json; charset=utf-8", contentType : "application/json; charset=utf-8",
data: {
data: JSON.stringify({ dscdmngIds : dscdmngIds,
"dscdmngIds" : dscdmngIds, userId : "${currentUser.account}",
"userId" : "${currentUser.account}", deptCd: "${currentUser.deptCode}",
"deptCd": "${currentUser.deptCode}" adds12: ADDS12
}), },
success:resp => { success:resp => {
if(!resp.success){ if(!resp.success){
dialog.alert({ dialog.alert({

Loading…
Cancel
Save