Merge branch 'bo_fixes' into 'dev'
[BO] 수정사항 반영 (1) See merge request korea-research/korea-research!112
This commit is contained in:
@@ -29,9 +29,7 @@
|
||||
<if test="employmentType != null and employmentType != ''">
|
||||
employment_type = #{employmentType},
|
||||
</if>
|
||||
<if test="memo != null and memo != ''">
|
||||
memo = #{memo},
|
||||
</if>
|
||||
<include refid="common.fields.UpdateBaseSet"/>
|
||||
WHERE seq = #{householdSeq}
|
||||
</update>
|
||||
|
||||
@@ -259,10 +259,14 @@ uiUtil.uploadFile = (fileUploadType, input) => {
|
||||
},
|
||||
statusCode: {
|
||||
// 실패 - validation fail
|
||||
400: (res) => {
|
||||
alert(res.responseJSON.message);
|
||||
},
|
||||
422: (res) => {
|
||||
const resJson = res.responseJSON;
|
||||
$(input).parent().find('.invalid-feedback').text(resJson.message);
|
||||
$(input).addClass('is-invalid');
|
||||
alert(resJson.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -81,9 +81,7 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
|
||||
</th>
|
||||
<th>선택</th>
|
||||
<th>조사원명</th>
|
||||
<th>전화번호</th>
|
||||
<th>실사</th>
|
||||
@@ -117,8 +115,13 @@
|
||||
<script th:inline="javascript">
|
||||
let researcherList = [];
|
||||
|
||||
const showResearcherModal = () => {
|
||||
document.querySelector(".modal-researcher-mapping").ui.open();
|
||||
const showResearcherModal = (type) => {
|
||||
const checked = document.querySelectorAll('input[name="chkBox"]:checked');
|
||||
|
||||
if(type === 'LIST' && checked.length === 0) {
|
||||
alert("임가를 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 실사 공통코드 가져오기
|
||||
ajaxUtil._ajaxMethod(
|
||||
@@ -141,6 +144,8 @@
|
||||
'json'
|
||||
);
|
||||
|
||||
document.querySelector(".modal-researcher-mapping").ui.open();
|
||||
|
||||
getResearchers(document.reqResearcherForm.page.value);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<td colspan="3">
|
||||
<div class="input-file-group">
|
||||
<label for="file" class="input-file-btn">
|
||||
<input type="file" name="multipartAttachments" id="file" onchange="uiUtil.uploadFile('NOTICE', this);" >
|
||||
<input type="file" name="multipartAttachments" id="file" onchange="validateFileSize(this) && uiUtil.uploadFile('NOTICE', this);" >
|
||||
<span class="file-txt">파일첨부</span>
|
||||
</label>
|
||||
<p class="desc">첨부 가능 파일 형식: 문서(pdf, docx, xlsx, pptx, hwp), 이미지(jpg, jpeg, png, gif), 기타(zip,
|
||||
@@ -177,6 +177,18 @@
|
||||
});
|
||||
}
|
||||
|
||||
// JavaScript 함수 추가
|
||||
function validateFileSize(input) {
|
||||
const maxSize = 5 * 1024 * 1024; // 5MB
|
||||
const file = input.files[0];
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
alert('파일 크기는 5MB 이하만 업로드 가능합니다.');
|
||||
input.value = ''; // 파일 선택 초기화
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<td colspan="3">
|
||||
<div class="input-file-group">
|
||||
<label for="file" class="input-file-btn">
|
||||
<input type="file" name="multipartAttachments" id="file" onchange="uiUtil.uploadFile('NOTICE', this);" >
|
||||
<input type="file" name="multipartAttachments" id="file" onchange="validateFileSize(this) && uiUtil.uploadFile('NOTICE', this);" >
|
||||
<span class="file-txt">파일첨부</span>
|
||||
</label>
|
||||
<p class="desc">첨부 가능 파일 형식: 문서(pdf, docx, xlsx, pptx, hwp), 이미지(jpg, jpeg, png, gif), 기타(zip,
|
||||
@@ -231,6 +231,19 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// JavaScript 함수 추가
|
||||
function validateFileSize(input) {
|
||||
const maxSize = 5 * 1024 * 1024; // 5MB
|
||||
const file = input.files[0];
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
alert('파일 크기는 5MB 이하만 업로드 가능합니다.');
|
||||
input.value = ''; // 파일 선택 초기화
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -281,8 +281,8 @@
|
||||
onclick="location.href='/households/create'">
|
||||
<span class="btn-txt">임가 등록</span>
|
||||
</button>
|
||||
<!-- 관리자, 지방실사만 노출 -->
|
||||
<button type="button" class="btn" th:if="${userRole != 'ROLE_RESEARCHER'}" onclick="showResearcherModal();">
|
||||
<!-- 관리자만 노출 -->
|
||||
<button type="button" class="btn" th:if="${userRole == 'ROLE_ADMIN'}" onclick="showResearcherModal('LIST');">
|
||||
<span class="btn-txt">조사원 매핑</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -381,7 +381,7 @@
|
||||
JSON.stringify(dataOj),
|
||||
function(response) { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
location.href = '/households';
|
||||
location.href = '/households/' + f.householdSeq.value;
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
|
||||
@@ -112,9 +112,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="component-btns bottom-btn-group" th:if="${userRole == 'ROLE_ADMIN'}">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn" th:if="${userRole == 'ROLE_ADMIN'}" onclick="showResearcherModal();">
|
||||
<button type="button" class="btn" onclick="showResearcherModal();">
|
||||
<span class="btn-txt">조사원 매핑</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" onclick="goUpdateForm();">
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package app.module.core.usecase.file.createFile.ports.application;
|
||||
|
||||
import app.module.core.config.application.enums.FileUploadType;
|
||||
import app.module.core.usecase.file.createFile.ports.CreateFilePortIn;
|
||||
import app.module.core.usecase.file.createFile.ports.CreateFilePortOut;
|
||||
import app.module.core.usecase.file.createFile.ports.application.domain.CreateFile;
|
||||
import app.module.core.usecase.file.createFile.ports.application.domain.CreateFileCmd;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class CreateFileService implements CreateFilePortIn {
|
||||
@@ -16,6 +19,24 @@ class CreateFileService implements CreateFilePortIn {
|
||||
|
||||
@Override
|
||||
public Optional<CreateFile> operate(CreateFileCmd command) {
|
||||
validateFileSize(command);
|
||||
return portOut.operate(command);
|
||||
}
|
||||
|
||||
private void validateFileSize(CreateFileCmd command) {
|
||||
// 공지사항 파일 업로드 형식 파일당 최대 5MB
|
||||
if(FileUploadType.NOTICE.equals(command.getType())) {
|
||||
long NOTICE_MAX_FILE_SIZE = 5 * 1024 * 1024;
|
||||
|
||||
if (command.getFileLength() != null && command.getFileLength() > NOTICE_MAX_FILE_SIZE) {
|
||||
log.info(String.format(
|
||||
"파일 크기는 5MB 이하만 업로드 가능합니다: %s (크기: %.2fMB)",
|
||||
command.getOriginName(),
|
||||
command.getFileLength() / (1024.0 * 1024.0)
|
||||
));
|
||||
|
||||
throw new IllegalArgumentException("파일 크기는 5MB 이하만 업로드 가능합니다");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user