Merge pull request #14 from miniplugin/contribution

윈도우 시스템에서도 다국어 메세지 경로를 사용 및  포털사이트의 묻고답하기 신규 등록시 첨부파일 업로드의 post 테이블에 attachmentCode 누락되는 부분 처리
This commit is contained in:
overpassion
2023-06-12 14:20:03 +09:00
committed by GitHub
18 changed files with 87 additions and 22 deletions

4
.gitignore vendored
View File

@@ -56,8 +56,10 @@ HELP.md
**/out/ **/out/
# production # production
**/build !**/build/
**/build/*
**/dist **/dist
!backend/module-common/build/libs/
# misc # misc
**.DS_Store **.DS_Store

View File

@@ -28,8 +28,8 @@ ext {
} }
dependencies { dependencies {
// implementation files('../../module-common/build/libs/module-common-0.1.jar') // 공통 모듈, @ComponentScan(basePackages={"org.egovframe.cloud"}) 추가해야 적용된다 implementation files('../module-common/build/libs/module-common-4.1.0-plain.jar') // 공통 모듈, @ComponentScan(basePackages={"org.egovframe.cloud"}) 추가해야 적용된다
implementation 'org.egovframe.cloud:module-common:0.1' // implementation 'org.egovframe.cloud:module-common:0.1'
implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.1.0') { implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.1.0') {
exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging' exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging'
} }

Binary file not shown.

View File

@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -8,6 +8,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource; import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.io.File;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
@@ -41,6 +42,7 @@ public class MessageSourceConfig {
@Value("${spring.profiles.active:default}") @Value("${spring.profiles.active:default}")
private String profile; private String profile;
private static final String FILE_SEPARATOR = File.separator;
@Bean @Bean
public MessageSource messageSource() { public MessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
@@ -48,6 +50,9 @@ public class MessageSourceConfig {
if ("default".equals(profile)) { if ("default".equals(profile)) {
Path fileStorageLocation = Paths.get(messagesDirectory).toAbsolutePath().normalize(); Path fileStorageLocation = Paths.get(messagesDirectory).toAbsolutePath().normalize();
String dbMessages = StringUtils.cleanPath("file://" + fileStorageLocation + MESSAGES); String dbMessages = StringUtils.cleanPath("file://" + fileStorageLocation + MESSAGES);
if(FILE_SEPARATOR.equals("\\")) {//윈도우기반 자바시스템일 때 Could not parse properties file 에러방지
dbMessages = StringUtils.cleanPath("file:///" + fileStorageLocation + MESSAGES);
}
messageSource.setBasenames(dbMessages); messageSource.setBasenames(dbMessages);
} else { } else {
messageSource.setBasenames(messagesDirectory + MESSAGES); messageSource.setBasenames(messagesDirectory + MESSAGES);

View File

@@ -28,8 +28,8 @@ ext {
} }
dependencies { dependencies {
// implementation files('../../module-common/build/libs/module-common-0.1.jar') // 공통 모듈, @ComponentScan(basePackages={"org.egovframe.cloud"}) 추가해야 적용된다 implementation files('../module-common/build/libs/module-common-4.1.0-plain.jar') // 공통 모듈, @ComponentScan(basePackages={"org.egovframe.cloud"}) 추가해야 적용된다
implementation 'org.egovframe.cloud:module-common:0.1' // implementation 'org.egovframe.cloud:module-common:0.1'
implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.1.0') { implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.1.0') {
exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging' exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging'
} }

View File

@@ -51,10 +51,16 @@ public class FileStorageUtils implements StorageUtils {
private final Path fileStorageLocation; private final Path fileStorageLocation;
private final Environment environment; private final Environment environment;
private final MessageUtil messageUtil; private final MessageUtil messageUtil;
private static final String FILE_SEPARATOR = File.separator;
public FileStorageUtils(Environment environment, MessageUtil messageUtil) { public FileStorageUtils(Environment environment, MessageUtil messageUtil) {
this.environment = environment; this.environment = environment;
this.fileStorageLocation = Paths.get(environment.getProperty("file.directory")).toAbsolutePath().normalize(); String envFileDir = "";
envFileDir = environment.getProperty("file.directory");
if(FILE_SEPARATOR.equals("\\")) {//윈도우기반 자바시스템일 때 경로 에러방지
envFileDir = envFileDir.replaceAll("/", "\\\\");
}
this.fileStorageLocation = Paths.get(envFileDir).toAbsolutePath().normalize();
this.messageUtil = messageUtil; this.messageUtil = messageUtil;
} }
@@ -185,8 +191,9 @@ public class FileStorageUtils implements StorageUtils {
Path path = getStorePath(basePath); Path path = getStorePath(basePath);
Path target = path.resolve(filename); Path target = path.resolve(filename);
Files.copy(file.getInputStream(), target, StandardCopyOption.REPLACE_EXISTING); InputStream inputStream = file.getInputStream();
Files.copy(inputStream, target, StandardCopyOption.REPLACE_EXISTING);
inputStream.close(); //윈도우 시스템에서도 업로드 시 Temp폴더의 delete file 에러방지코드 추가
return filename; return filename;
} catch (IOException ex) { } catch (IOException ex) {
log.error("Could not stored file", ex); log.error("Could not stored file", ex);

View File

@@ -25,8 +25,8 @@ ext {
} }
dependencies { dependencies {
// implementation files('../../module-common/build/libs/module-common-0.1.jar') // @ComponentScan(basePackages={"org.egovframe.cloud"}) 추가해야 적용된다 implementation files('../module-common/build/libs/module-common-4.1.0-plain.jar') // 공통 모듈, @ComponentScan(basePackages={"org.egovframe.cloud"}) 추가해야 적용된다
implementation 'org.egovframe.cloud:module-common:0.1' // implementation 'org.egovframe.cloud:module-common:0.1'
implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.1.0') { implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.1.0') {
exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging' exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging'
} }

View File

@@ -25,8 +25,8 @@ ext {
} }
dependencies { dependencies {
// implementation files('../../module-common/build/libs/module-common-0.1.jar') // @ComponentScan(basePackages={"org.egovframe.cloud"}) 추가해야 적용된다 implementation files('../module-common/build/libs/module-common-4.1.0-plain.jar') // 공통 모듈, @ComponentScan(basePackages={"org.egovframe.cloud"}) 추가해야 적용된다
implementation 'org.egovframe.cloud:module-common:0.1' // implementation 'org.egovframe.cloud:module-common:0.1'
implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.1.0') { implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.1.0') {
exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging' exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging'
} }

View File

@@ -26,8 +26,8 @@ ext {
dependencies { dependencies {
// implementation files('../../module-common/build/libs/module-common-0.1.jar') // @ComponentScan(basePackages={"org.egovframe.cloud"}) 추가해야 적용된다 implementation files('../module-common/build/libs/module-common-4.1.0-plain.jar') // 공통 모듈, @ComponentScan(basePackages={"org.egovframe.cloud"}) 추가해야 적용된다
implementation 'org.egovframe.cloud:module-common:0.1' // implementation 'org.egovframe.cloud:module-common:0.1'
implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.1.0') { implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.1.0') {
exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging' exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging'
} }

View File

@@ -28,8 +28,8 @@ ext {
} }
dependencies { dependencies {
// implementation files('../../module-common/build/libs/module-common-0.1.jar') // 공통 모듈, @ComponentScan(basePackages={"org.egovframe.cloud"}) 추가해야 적용된다 implementation files('../module-common/build/libs/module-common-4.1.0-plain.jar') // 공통 모듈, @ComponentScan(basePackages={"org.egovframe.cloud"}) 추가해야 적용된다
implementation 'org.egovframe.cloud:module-common:0.1' // implementation 'org.egovframe.cloud:module-common:0.1'
implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.1.0') { implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.1.0') {
exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging' exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging'
} }

View File

@@ -7,7 +7,7 @@
"npm": "6.14.7" "npm": "6.14.7"
}, },
"scripts": { "scripts": {
"dev": "next dev", "dev": "ts-node --transpile-only --project tsconfig.server.json server/index.ts",
"dev:sm": "SITE_ID=3 npm run dev", "dev:sm": "SITE_ID=3 npm run dev",
"dev:lg": "SITE_ID=2 npm run dev", "dev:lg": "SITE_ID=2 npm run dev",
"dev:smWin": "set SITE_ID=3&&npm run dev", "dev:smWin": "set SITE_ID=3&&npm run dev",

View File

@@ -1137,6 +1137,7 @@ footer div > span a {
font-size: 32px; font-size: 32px;
line-height: 32px; line-height: 32px;
text-shadow: 10px 10px 10px rgba(0, 0, 0, 0.5); text-shadow: 10px 10px 10px rgba(0, 0, 0, 0.5);
background: rgba(0, 0, 0, 0.3);
/* overflow: hidden; /* overflow: hidden;
white-space: break-spaces; white-space: break-spaces;
word-break: keep-all; */ word-break: keep-all; */
@@ -1147,6 +1148,7 @@ footer div > span a {
left: 6vw; left: 6vw;
color: rgba(255, 255, 255, 0.7); color: rgba(255, 255, 255, 0.7);
font-size: 1.7vw; font-size: 1.7vw;
background: rgba(0, 0, 0, 0.3);
} }
#main .slideBox a:before { #main .slideBox a:before {
content: '╋'; content: '╋';
@@ -1185,7 +1187,7 @@ footer div > span a {
#main .slide .reservBox { #main .slide .reservBox {
position: absolute; position: absolute;
top: 600px; top: 650px;
left: 0; left: 0;
z-index: 10; z-index: 10;
width: 100%; width: 100%;

View File

@@ -1140,7 +1140,8 @@ footer div > span a {
overflow: hidden; overflow: hidden;
} }
#main .slide div.slide-title p { #main .slide div.slide-title p {
height: 12vw; /* height: 12vw; */
background: rgba(0, 0, 0, 0.3);
color: #fff; color: #fff;
font-size: 2.7vw; font-size: 2.7vw;
font-weight: 600; font-weight: 600;
@@ -1171,6 +1172,7 @@ footer div > span a {
left: 6vw; left: 6vw;
color: rgba(255, 255, 255, 0.7); color: rgba(255, 255, 255, 0.7);
font-size: 1.7vw; font-size: 1.7vw;
background: rgba(0, 0, 0, 0.3);
} }
#main .slide a:before { #main .slide a:before {
content: '╋'; content: '╋';

View File

@@ -0,0 +1,30 @@
import { loadEnvConfig } from '@next/env'
import express, { Request, Response } from 'express'
import next from 'next'
loadEnvConfig('./', process.env.NODE_ENV !== 'production')
const port = process.env.PORT || 3000
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()
const startServer = async () => {
try {
await app.prepare()
const server = express()
server.all('*', (req: Request, res: Response) => {
return handle(req, res)
})
server.listen(port, (err?: any) => {
if (err) throw err
console.log(`> Ready on localhost:${port} - env ${process.env.NODE_ENV}`)
})
} catch (error) {
console.error(error)
process.exit(1)
}
}
startServer()

View File

@@ -146,15 +146,18 @@ const BoardEdit = (props: BoardEditProps) => {
data = produce(data, draft => { data = produce(data, draft => {
draft.attachmentCode = result draft.attachmentCode = result
}) })
}
}
})
}
})
}
save(data) save(data)
} }
}
})
}else{
save(data)
}
})
}else{
save(data)
}
}
}, [postData, attachList]) }, [postData, attachList])
useEffect(() => { useEffect(() => {

View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json", // 기본설정을 포함한다
"compilerOptions": {
"module": "commonjs", // commonJs 사용하도록 override
"outDir": "dist", // 빌드 파일 경로 (production mode)
"noEmit": false // 서버에 대한 결과 파일을 내보내지 않음 (production mode)
},
"include": ["server"] // server/ 디렉토리 아래에 있는 파일만 컴파일 (production mode)
}