|
|
|
@ -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;
|
|
|
|
@ -79,6 +79,9 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
@Value("${app.inf.nims.api.prdMnfSeqInfoOfBarcode}")
|
|
|
|
|
private String prdMnfSeqInfoOfBarcodeEndpoint;
|
|
|
|
|
|
|
|
|
|
@Value("${app.inf.nims.api.dsuseMgtListForRptDoc}")
|
|
|
|
|
private String dsuseMgtListForRptDocEndpoint;
|
|
|
|
|
|
|
|
|
|
@Resource(name="sigunguDepartmentService")
|
|
|
|
|
private SigunguDepartmentService sggDeptService;
|
|
|
|
|
|
|
|
|
@ -280,6 +283,48 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
return setCollectionInfo(new ModelAndView("jsonView"), dsuseMgtDocService.getDsuseMgtDocList(query),"","");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@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;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/makeDisposeResultReportHwp.do", name="폐기결과보고서 HWP파일 생성")
|
|
|
|
|
public ModelAndView makeDisposeResultReportHwp(String dtls) {
|
|
|
|
|
ModelAndView mav = new ModelAndView();
|
|
|
|
@ -638,10 +683,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<>() {});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|