From 4454856ccadb19f465ed648dab2a085ef6de4d83 Mon Sep 17 00:00:00 2001 From: minuk926 Date: Fri, 15 Jul 2022 12:18:35 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B0=95=EB=82=A8=EC=8B=AC=EC=82=AC=20?= =?UTF-8?q?=EC=86=8C=EC=8A=A4=20freezing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/biz/ctgy/auth/MinPasswordEncoder.java | 2 +- .../ctgy/v2/controller/CmmFileController.java | 4 +- .../v2/controller/CtgyFileMgtController.java | 63 +++---------------- .../xit/biz/ctgy/v2/repository/UserDao.java | 1 - .../ctgy/v2/service/impl/CtgyFileService.java | 2 +- .../config/database/BaseMpowerDaoSupport.java | 28 --------- src/main/resources/config/conf.yml | 7 +-- 7 files changed, 17 insertions(+), 90 deletions(-) diff --git a/src/main/java/com/xit/biz/ctgy/auth/MinPasswordEncoder.java b/src/main/java/com/xit/biz/ctgy/auth/MinPasswordEncoder.java index 8270951..5cdb358 100644 --- a/src/main/java/com/xit/biz/ctgy/auth/MinPasswordEncoder.java +++ b/src/main/java/com/xit/biz/ctgy/auth/MinPasswordEncoder.java @@ -49,7 +49,7 @@ public class MinPasswordEncoder implements PasswordEncoder { return false; } - return Objects.equals(minUserinfoDao.queryGetPasswd(rawPassword.toString()), encodedPassword); + return Objects.equals(minUserinfoDao.queryGetPasswdEncode(rawPassword.toString()), encodedPassword); } /** diff --git a/src/main/java/com/xit/biz/ctgy/v2/controller/CmmFileController.java b/src/main/java/com/xit/biz/ctgy/v2/controller/CmmFileController.java index fddd80f..27ad5a0 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/controller/CmmFileController.java +++ b/src/main/java/com/xit/biz/ctgy/v2/controller/CmmFileController.java @@ -45,8 +45,8 @@ public class CmmFileController { @Value("${file.cmm.upload.root:c:/data/file/upload}") private String rootPath; - @Value("${file.cmm.upload.path:/kangnamSIM/simUpFile/}") - private String uploadPath; +// @Value("${file.cmm.upload.path:/kangnamSIM/simUpFile/}") +// private String uploadPath; @Value("${file.cmm.upload.simsaPath:[simUpFile_sc1]}") private String[] judgeUploadPath; diff --git a/src/main/java/com/xit/biz/ctgy/v2/controller/CtgyFileMgtController.java b/src/main/java/com/xit/biz/ctgy/v2/controller/CtgyFileMgtController.java index ded33c3..b7cc269 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/controller/CtgyFileMgtController.java +++ b/src/main/java/com/xit/biz/ctgy/v2/controller/CtgyFileMgtController.java @@ -38,12 +38,12 @@ import java.util.Arrays; @RequestMapping("/api/v2/ctgy/file") public class CtgyFileMgtController { - private final Environment env; + //private final Environment env; - @Value("${file.cmm.upload.root:c:/data/file/upload}") + @Value("${file.cmm.upload.root}") private String rootPath; - @Value("${file.cmm.upload.path:/kangnamSIM/simUpFile/}") + @Value("${file.cmm.upload.pboard}") private String uploadPath; @Value("${file.cmm.upload.url}") @@ -80,12 +80,14 @@ public class CtgyFileMgtController { MinInfoBoard680Dto dto = service.findFiles(inCode); - String absFile = ""; +// String absFile = ""; +// +// if (Arrays.asList(env.getActiveProfiles()).contains("local")) +// absFile = rootPath + dto.getInFileurl().split(serviceUrl)[1] + "/"+ dto.getInFilename(); +// else +// absFile = dto.getInFileurl() + "/" + dto.getInFilename(); - if (Arrays.asList(env.getActiveProfiles()).contains("local")) - absFile = dto.getInFileurl() + File.separator + dto.getInFilename(); - else - absFile = rootPath + dto.getInFileurl().split(serviceUrl)[1] + File.separator + dto.getInFilename(); + String absFile = absFile = rootPath + uploadPath + "/" + dto.getInFilename(); Path path = Paths.get(absFile); String contentType = null; @@ -121,49 +123,4 @@ public class CtgyFileMgtController { throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND); } } - - @GetMapping("/download2/{inCode}") - public ResponseEntity download(@PathVariable Long inCode, HttpServletResponse response) { - - MinInfoBoard680Dto entity = service.findFiles(inCode); - - String absFile = ""; - - if (Arrays.asList(env.getActiveProfiles()).contains("local")) - absFile = entity.getInFileurl() + File.separator + entity.getInFilename(); - else - absFile = rootPath + entity.getInFileurl().split(serviceUrl)[1] + File.separator + entity.getInFilename(); - - Path path = Paths.get(absFile); - String contentType = null; - try { - contentType = Files.probeContentType(path); - } catch (IOException e) { - throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND); - } - -// File file = new File(absFile); -// try { -// byte[] fileByte = FileUtils.readFileToByteArray(file); -// } catch (IOException e) { -// throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND); -// } - - - HttpHeaders headers = new HttpHeaders(); - headers.add(HttpHeaders.CONTENT_TYPE, contentType); - headers.setContentDisposition(ContentDisposition.builder("attachment") - .filename(entity.getInFilename(), StandardCharsets.UTF_8) - //.filename(URLEncoder.encode(entity.getInFilename(), "utf-8")) - .build()); - headers.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(entity.getInFilesize())); - - Resource resource = null; - try { - resource = new InputStreamResource(Files.newInputStream(path)); - } catch (IOException e) { - throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND); - } - return new ResponseEntity<>(resource, headers, HttpStatus.OK); - } } diff --git a/src/main/java/com/xit/biz/ctgy/v2/repository/UserDao.java b/src/main/java/com/xit/biz/ctgy/v2/repository/UserDao.java index b7a66fa..2a4b92b 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/repository/UserDao.java +++ b/src/main/java/com/xit/biz/ctgy/v2/repository/UserDao.java @@ -47,7 +47,6 @@ public class UserDao extends BaseMpowerDaoSupport { return selectOneColumn(sql); } - //@Query(value = "SELECT ECL_DECRYPT(MU.passwd) AS passwd FROM min_userinfo MU WHERE MU.userid = ?1", nativeQuery = true) public String queryGetPasswd(@NotNull final String userid){ final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectPasswdDec") .setParameter("userid", userid) diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/CtgyFileService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/CtgyFileService.java index a991eb0..ee82b8d 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/CtgyFileService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/CtgyFileService.java @@ -29,7 +29,7 @@ public class CtgyFileService implements ICtgyFileService { @Value("${file.cmm.upload.root:c:/data/file/upload}") private String rootPath; - @Value("${file.cmm.upload.path:/kangnamSIM/simUpFile/}") + @Value("${file.cmm.upload.pboard}") private String uploadPath; @Value("${file.cmm.upload.url}") diff --git a/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java b/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java index c21d996..a8824fc 100644 --- a/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java +++ b/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java @@ -491,17 +491,14 @@ public abstract class BaseMpowerDaoSupport { int index = 1; if("picad".equals(imgDiv)){ - log.info("<<< ==== Mpower picad 이미지 file name ====>>>"); // A, B, C, D for(int idx = 0; idx <=3; idx++) client.setInput("dnfile"+index++,mpowerFilePre + fileNames.get(idx)); }else if("frecad".equals(imgDiv)) { - log.info("<<< ==== Mpower frecad 이미지 file name ====>>>"); index = 1; // A, B, C, D for (int idx = 0; idx <= 3; idx++) client.setInput("dnfile" + index++, mpowerFilePre + fileNames.get(idx)); }else { - log.info("<<< ==== Mpower contad 이미지 file name ====>>>"); index = 1; // F, G, H, I for (int idx = 5; idx <= 8; idx++) client.setInput("dnfile" + index++, mpowerFilePre + fileNames.get(idx)); @@ -513,7 +510,6 @@ public abstract class BaseMpowerDaoSupport { if (result.equals("true")){ fileDownAndSet(list, client, svrSavedPhotoPath, file); - }else{ throw new MpowerException("MPower File download error::"+result); } @@ -530,7 +526,6 @@ public abstract class BaseMpowerDaoSupport { // 진술서 return //----------------------------------------------------------------- if("frecad".equals(imgDiv)) { - log.info("<<< ==== Mpower frecad 이미지 file name ====>>>"); // E client.setInput("dnfile1", mpowerFilePre + "E.jpg"); client.Request(); @@ -544,9 +539,6 @@ public abstract class BaseMpowerDaoSupport { client.savefile("imageA", svrSavedPhotoPath); } setFileInfo(list, client.getFileName("imageA"), svrSavedPhotoPath); - - } else { - setNoFileInfo(list); } } return list; @@ -558,7 +550,6 @@ public abstract class BaseMpowerDaoSupport { //----------------------------------------------------------------- // 참고자료 return //----------------------------------------------------------------- - log.info("<<< ==== Mpower contad 이미지 file name ====>>>"); index = 1; // J, K, L, M for (int idx = 9; idx <= 12; idx++) client.setInput("dnfile" + index++, mpowerFilePre + fileNames.get(idx)); @@ -588,11 +579,7 @@ public abstract class BaseMpowerDaoSupport { client.savefile("imageA", svrSavedPhotoPath); } setFileInfo(list, client.getFileName("imageA"), svrSavedPhotoPath); - } -// else{ -// setNoFileInfo(list); -// } if(Checks.isNotEmpty(client.getFileName("imageB"))){ if(!file.exists()) file.mkdirs(); @@ -602,9 +589,6 @@ public abstract class BaseMpowerDaoSupport { } setFileInfo(list, client.getFileName("imageB"), svrSavedPhotoPath); } -// else{ -// setNoFileInfo(list); -// } }else{ throw new MpowerException("MPower File download error::"+result); @@ -629,9 +613,6 @@ public abstract class BaseMpowerDaoSupport { setFileInfo(list, client.getFileName("imageA"), svrSavedPhotoPath); } -// else{ -// setNoFileInfo(list); -// } if(Checks.isNotEmpty(client.getFileName("imageB"))){ if(!file.exists()) file.mkdirs(); @@ -641,9 +622,6 @@ public abstract class BaseMpowerDaoSupport { } setFileInfo(list, client.getFileName("imageB"), svrSavedPhotoPath); } -// else{ -// setNoFileInfo(list); -// } if(Checks.isNotEmpty(client.getFileName("imageC"))){ if(!file.exists()) file.mkdirs(); @@ -653,9 +631,6 @@ public abstract class BaseMpowerDaoSupport { } setFileInfo(list, client.getFileName("imageC"), svrSavedPhotoPath); } -// else{ -// setNoFileInfo(list); -// } if(Checks.isNotEmpty(client.getFileName("imageD"))){ if(!file.exists()) file.mkdirs(); @@ -665,9 +640,6 @@ public abstract class BaseMpowerDaoSupport { } setFileInfo(list, client.getFileName("imageD"), svrSavedPhotoPath); } -// else{ -// setNoFileInfo(list); -// } } private void setFileInfo(List> list, String imgName, String strpath) { diff --git a/src/main/resources/config/conf.yml b/src/main/resources/config/conf.yml index e79f523..06f7889 100644 --- a/src/main/resources/config/conf.yml +++ b/src/main/resources/config/conf.yml @@ -12,7 +12,7 @@ xit: # api response logging 여부 api: reponse: - logging: true + logging: false file: cmm: @@ -20,8 +20,7 @@ file: root: d:/data/file/upload # root: /Users/minuk/data/file/upload # 공지사항 - path: /kangnamSIM/simUpFile - publicPath: /simUpFile #/kangnamSIM/simUpFile + pboard: /simUpFile #/kangnamSIM/simUpFile simsaPath: /simUpFile_sc1, /simUpFile_sc2 # 거주자 simUpFile_sc1, 장애인 simUpFile_sc2 url: http://traffic.gangnam.go.kr allow: @@ -43,7 +42,7 @@ mpower: port: 9999 serviceName: XitFile.XitDownload # 단속사진 - picadPath: C:\\NewTraffic_Photo\\JUCHA_PHOTO\\ + picadPath: C:/NewTraffic_Photo/JUCHA_PHOTO/ # 진술서 frecadPath: /picad # 첨부자료