|
|
|
@ -93,6 +93,12 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
@Value("${app.inf.nims.api.saveDsuseMgtReceipt}")
|
|
|
|
|
private String saveDsuseMgtReceiptEndpoint;
|
|
|
|
|
|
|
|
|
|
@Value("${app.inf.nims.api.nimsRptDsuseMgtMapping}")
|
|
|
|
|
private String dsuseRptAndDsuseMgtMappingEndpoint;
|
|
|
|
|
|
|
|
|
|
@Value("${app.inf.nims.api.modifyMappingDsuseMgt}")
|
|
|
|
|
private String modifyMappingDsuseMgtEndpoint;
|
|
|
|
|
|
|
|
|
|
@Resource(name="sigunguDepartmentService")
|
|
|
|
|
private SigunguDepartmentService sggDeptService;
|
|
|
|
|
|
|
|
|
@ -488,10 +494,9 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
|
|
|
|
|
String rslt = apiRslt.body();
|
|
|
|
|
return json.parse(rslt, new TypeReference<>() {});
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
|
|
} catch (IOException | InterruptedException e){
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -517,12 +522,22 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
|
|
|
|
|
String rslt = apiRslt.body();
|
|
|
|
|
return json.parse(rslt, new TypeReference<>() {});
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
|
|
} catch (IOException | InterruptedException e){
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getDsuseRptAndDsuseMgtMapping.do", name="폐기보고 매핑 조회", produces = "application/json;charset=UTF-8")
|
|
|
|
|
public @ResponseBody ApiBaseResponse<List<JSONObject>> getDsuseRptAndDsuseMgtMapping(@ModelAttribute NimsApiRequest.DsuseRptMappingInqReq dto) {
|
|
|
|
|
String rslt = ApiUtil.callNimsApi(apiHost + dsuseRptAndDsuseMgtMappingEndpoint, dto);
|
|
|
|
|
return json.parse(rslt, new TypeReference<>() {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/modifyMappingDsuseMgt.do", name="폐기보고 확인 정보 저장", produces = "application/json;charset=UTF-8")
|
|
|
|
|
public @ResponseBody ApiBaseResponse<List<JSONObject>> modifyMappingDsuseMgt(@ModelAttribute NimsApiRequest.DsuseMgtMappingReq dto) {
|
|
|
|
|
String rslt = ApiUtil.callNimsApi(apiHost + modifyMappingDsuseMgtEndpoint, dto);
|
|
|
|
|
return json.parse(rslt, new TypeReference<>() {});
|
|
|
|
|
}
|
|
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
|
|
// API server call
|
|
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
|
@ -717,29 +732,9 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
var byteOut = new ByteArrayOutputStream();
|
|
|
|
|
String lineSeparator = "\r\n";
|
|
|
|
|
|
|
|
|
|
// JSON part
|
|
|
|
|
byteOut.write(("--" + boundary + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Disposition: form-data; name=\"dsuseMgtRsltJsonStr\"" + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Type: application/json; charset=UTF-8" + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write((dsuseMgtRsltJsonStr + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
|
|
|
|
|
// File parts
|
|
|
|
|
if (files != null) {
|
|
|
|
|
for (MultipartFile file : files) {
|
|
|
|
|
byteOut.write(("--" + boundary + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Disposition: form-data; name=\"dsuseDsuseImgFiles\"; filename=\"" + file.getOriginalFilename() + "\"" + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Type: " + file.getContentType() + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(file.getBytes());
|
|
|
|
|
byteOut.write((lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// fileChangeYn part
|
|
|
|
|
byteOut.write(("--" + boundary + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Disposition: form-data; name=\"fileChangeYn\"" + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Type: text/plain; charset=UTF-8" + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write((fileChangeYn + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
|
|
|
|
|
writeJsonString("dsuseMgtRsltJsonStr", dsuseMgtRsltJsonStr, boundary, byteOut, lineSeparator);
|
|
|
|
|
writeMultipartFiles("dsuseDsuseImgFiles", files, boundary, byteOut, lineSeparator);
|
|
|
|
|
writeJsonString("fileChangeYn", fileChangeYn, boundary, byteOut, lineSeparator);
|
|
|
|
|
byteOut.write(("--" + boundary + "--" + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
|
|
|
|
|
return HttpRequest.BodyPublishers.ofByteArray(byteOut.toByteArray());
|
|
|
|
@ -749,32 +744,33 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
var byteOut = new ByteArrayOutputStream();
|
|
|
|
|
String lineSeparator = "\r\n";
|
|
|
|
|
|
|
|
|
|
// JSON part
|
|
|
|
|
byteOut.write(("--" + boundary + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Disposition: form-data; name=\"dsuseMgtJsonStr\"" + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Type: application/json; charset=UTF-8" + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write((dsuseMgtJsonStr + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
writeJsonString("dsuseMgtJsonStr", dsuseMgtJsonStr, boundary, byteOut, lineSeparator);
|
|
|
|
|
writeMultipartFiles("dsusePrdImgFiles", files, boundary, byteOut, lineSeparator);
|
|
|
|
|
writeJsonString("dsuseMgtDtlsJsonStr", dsuseMgtDtlsJsonStr, boundary, byteOut, lineSeparator);
|
|
|
|
|
byteOut.write(("--" + boundary + "--" + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
|
|
|
|
|
return HttpRequest.BodyPublishers.ofByteArray(byteOut.toByteArray());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// File parts
|
|
|
|
|
private static void writeMultipartFiles(String attName, List<MultipartFile> files, String boundary, ByteArrayOutputStream byteOut,
|
|
|
|
|
String lineSeparator) throws IOException {
|
|
|
|
|
if (files != null) {
|
|
|
|
|
for (MultipartFile file : files) {
|
|
|
|
|
byteOut.write(("--" + boundary + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Disposition: form-data; name=\"dsusePrdImgFiles\"; filename=\"" + file.getOriginalFilename() + "\"" + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Disposition: form-data; name=\"" + attName + "\"; filename=\"" + file.getOriginalFilename() + "\"" + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Type: " + file.getContentType() + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(file.getBytes());
|
|
|
|
|
byteOut.write((lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(lineSeparator.getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// fileChangeYn part
|
|
|
|
|
private static void writeJsonString(String attName, String dsuseMgtJsonStr, String boundary, ByteArrayOutputStream byteOut,
|
|
|
|
|
String lineSeparator) throws IOException {
|
|
|
|
|
byteOut.write(("--" + boundary + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Disposition: form-data; name=\"dsuseMgtDtlsJsonStr\"" + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Type: text/plain; charset=UTF-8" + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write((dsuseMgtDtlsJsonStr + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
|
|
|
|
|
byteOut.write(("--" + boundary + "--" + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
|
|
|
|
|
return HttpRequest.BodyPublishers.ofByteArray(byteOut.toByteArray());
|
|
|
|
|
byteOut.write(("Content-Disposition: form-data; name=\"" + attName + "\"" + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write(("Content-Type: application/json; charset=UTF-8" + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
byteOut.write((dsuseMgtJsonStr + lineSeparator).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
}
|
|
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
|
|
// private method
|
|
|
|
|