|
|
|
@ -6,11 +6,13 @@ import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import java.util.stream.IntStream;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
import org.json.simple.JSONObject;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
|
@ -19,8 +21,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
|
|
import net.minidev.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
|
|
|
|
|
|
|
import cokr.xit.adds.cmm.model.ApiBaseResponse;
|
|
|
|
@ -260,8 +260,44 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
return setCollectionInfo(new ModelAndView("jsonView"), dsuseMgtDocService.getDsuseMgtDocList(query),"","");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getHwpForRptDoc.do", name="보고문서 출력 상세 목록 조회", produces = "application/json;charset=UTF-8")
|
|
|
|
|
@RequestMapping(value = "/getHwpForRptDoc.do", name="보고문서 출력")
|
|
|
|
|
public ModelAndView getHwpForRptDoc(@ModelAttribute NimsApiRequest.DsuseMgtInqReq dto) {
|
|
|
|
|
String rslt = ApiUtil.callNimsApi(apiHost + dsuseMgtListForRptDocEndpoint, dto);
|
|
|
|
|
ApiBaseResponse<List<JSONObject>> parse = json.parse(rslt, new TypeReference<>() {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<JSONObject> respData = parse.getData();
|
|
|
|
|
List<JSONObject> dataForRptdoc = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
for(JSONObject mgtMaster : respData) {
|
|
|
|
|
List<JSONObject> mgtDetails = json.parse(json.stringify(mgtMaster.get("dsuseMgtDtls")), new TypeReference<>() {});
|
|
|
|
|
Set<String> keys = mgtMaster.keySet();
|
|
|
|
|
List<JSONObject> updatedDetails = mgtDetails.stream().map((detail) -> {
|
|
|
|
|
for (String key : keys) {
|
|
|
|
|
if (key.equals("dsuseMgtDtls")) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (key.equals("bsshNm") || key.equals("bsshCd")) {
|
|
|
|
|
detail.put(key + "0", mgtMaster.get(key));
|
|
|
|
|
} else if (!detail.containsKey(key)) {
|
|
|
|
|
detail.put(key, mgtMaster.get(key));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return detail;
|
|
|
|
|
}).toList();
|
|
|
|
|
dataForRptdoc.addAll(updatedDetails);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if("01".equals(dto.getAdds12())){
|
|
|
|
|
return makeDisposeResultReportHwp(json.stringify(dataForRptdoc));
|
|
|
|
|
}else if("02".equals(dto.getAdds12())) {
|
|
|
|
|
return makeDisposeProcessDetailsHwp(json.stringify(dataForRptdoc));
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -624,79 +660,4 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
|
|
|
|
|
return json.parse(rslt, new TypeReference<>() {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getNimsProductInfoKdAndMnfSeqInfo.do", name="제품 & 시리얼번호 검색", produces = "application/json;charset=UTF-8")
|
|
|
|
|
public @ResponseBody ApiBaseResponse<List<JSONObject>> getNimsProductInfoKdAndMnfSeqInfo(@ModelAttribute NimsApiRequest.ProductInfoReq dto) {
|
|
|
|
|
String rslt = ApiUtil.callNimsApi(apiHost + productAndseqInfoEndpoint, dto);
|
|
|
|
|
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<>() {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<JSONObject> respData = parse.getData();
|
|
|
|
|
List<DataObject> dataForRptdoc = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
for(JSONObject mgtMaster : respData) {
|
|
|
|
|
List<DataObject> mgtDetails = (List<DataObject>)mgtMaster.get("dsuseMgtDtls");
|
|
|
|
|
String[] keys = mgtMaster.keySet().toArray(new String[mgtMaster.keySet().size()]);
|
|
|
|
|
|
|
|
|
|
mgtDetails.stream().map((detail)->{
|
|
|
|
|
for(String key : keys) {
|
|
|
|
|
if(key.equals("dsuseMgtDtls")) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(key.equals("bsshNm") || key.equals("bsshCd")){
|
|
|
|
|
detail.put(key+"0", mgtMaster.get(key));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return detail;
|
|
|
|
|
}).toList();
|
|
|
|
|
|
|
|
|
|
dataForRptdoc.addAll(mgtDetails);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|