Merge branch 'susu' into dev
This commit is contained in:
@@ -54,6 +54,11 @@ public class ResearcherDao implements ResearcherPortOut {
|
|||||||
return new PageImpl<>(result, pageable, total);
|
return new PageImpl<>(result, pageable, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VisitHouseholdPercentageDto selectVisitHouseholdPercentage(ResearchersDetailReqVO reqVO) {
|
||||||
|
return researcherMapper.selectVisitHouseholdPercentage(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO) {
|
public Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO) {
|
||||||
List<ResearchersHouseholdVisitDto> result = researcherMapper.visitHouseholdList(reqVO);
|
List<ResearchersHouseholdVisitDto> result = researcherMapper.visitHouseholdList(reqVO);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public interface ResearcherMapper {
|
|||||||
ResearchersHouseholdVisitDto visitHouseholdDetail(Integer id);
|
ResearchersHouseholdVisitDto visitHouseholdDetail(Integer id);
|
||||||
Long visitHouseholdListCountAll(ResearchersDetailReqVO reqVO);
|
Long visitHouseholdListCountAll(ResearchersDetailReqVO reqVO);
|
||||||
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
||||||
|
VisitHouseholdPercentageDto selectVisitHouseholdPercentage(ResearchersDetailReqVO reqVO);
|
||||||
Integer visitHouseholdDelete(@Param("selectIds") List<Integer> selectIds,@Param("deletedBy") String deletedBy);
|
Integer visitHouseholdDelete(@Param("selectIds") List<Integer> selectIds,@Param("deletedBy") String deletedBy);
|
||||||
void deleteHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("deletedBy") String deletedBy);
|
void deleteHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("deletedBy") String deletedBy);
|
||||||
Integer insertHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("createdBy") String createdBy);
|
Integer insertHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("createdBy") String createdBy);
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.module.admin.usecase.researcher.adpaters.persistence.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class VisitHouseholdPercentageDto {
|
||||||
|
private Integer totalHouseholdCount;
|
||||||
|
private Integer firstVisitCount;
|
||||||
|
private Integer secondVisitCount;
|
||||||
|
private Integer giftSentCount;
|
||||||
|
private Double firstVisitPercentage;
|
||||||
|
private Double secondVisitPercentage;
|
||||||
|
private Double giftSentPercentage;
|
||||||
|
}
|
||||||
@@ -29,6 +29,11 @@ class ResearcherApiController {
|
|||||||
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.mappingHouseholdList(reqVO));
|
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.mappingHouseholdList(reqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(path = "/visitHousehold/percentage")
|
||||||
|
ResponseEntity<?> selectVisitHouseholdPercentage( @ModelAttribute ResearchersDetailReqVO reqVO) {
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.selectVisitHouseholdPercentage(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping(path = "/visitHousehold/list")
|
@GetMapping(path = "/visitHousehold/list")
|
||||||
ResponseEntity<?> visitHouseholdList( @ModelAttribute ResearchersDetailReqVO reqVO) {
|
ResponseEntity<?> visitHouseholdList( @ModelAttribute ResearchersDetailReqVO reqVO) {
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.visitHouseholdList(reqVO));
|
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.visitHouseholdList(reqVO));
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public interface ResearcherPortIn {
|
|||||||
ResearchersDto detail(Integer adminSeq);
|
ResearchersDto detail(Integer adminSeq);
|
||||||
Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
||||||
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
||||||
|
VisitHouseholdPercentageDto selectVisitHouseholdPercentage(ResearchersDetailReqVO reqVO);
|
||||||
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
||||||
ResearchersHouseholdVisitPopUpDto visitHouseholdDetail(Integer id);
|
ResearchersHouseholdVisitPopUpDto visitHouseholdDetail(Integer id);
|
||||||
Integer visitHouseholdDelete(List<Integer> selectIds);
|
Integer visitHouseholdDelete(List<Integer> selectIds);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ public interface ResearcherPortOut {
|
|||||||
Page<ResearchersDto> list(ResearchersListReqVO reqVO);
|
Page<ResearchersDto> list(ResearchersListReqVO reqVO);
|
||||||
ResearchersDto detail(Integer adminSeq);
|
ResearchersDto detail(Integer adminSeq);
|
||||||
Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
||||||
|
VisitHouseholdPercentageDto selectVisitHouseholdPercentage(ResearchersDetailReqVO reqVO);
|
||||||
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
||||||
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
||||||
ResearchersHouseholdVisitPopUpDto visitHouseholdDetail(Integer id);
|
ResearchersHouseholdVisitPopUpDto visitHouseholdDetail(Integer id);
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ class ResearcherService implements ResearcherPortIn {
|
|||||||
return portOut.visitHouseholdList(reqVO);
|
return portOut.visitHouseholdList(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VisitHouseholdPercentageDto selectVisitHouseholdPercentage(ResearchersDetailReqVO reqVO) {
|
||||||
|
return portOut.selectVisitHouseholdPercentage(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO) {
|
public Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO) {
|
||||||
return portOut.updateVisitHousehold(reqVO);
|
return portOut.updateVisitHousehold(reqVO);
|
||||||
|
|||||||
@@ -121,9 +121,8 @@
|
|||||||
case rhv.is_gift_sent when false then '전달완료' when true then '-' end is_gift_sent_flag,
|
case rhv.is_gift_sent when false then '전달완료' when true then '-' end is_gift_sent_flag,
|
||||||
rhv.created_at
|
rhv.created_at
|
||||||
from household_visit rhv
|
from household_visit rhv
|
||||||
join researcher_has_household rhh on rhh.household_seq = rhv.household_seq
|
join household h on rhv.household_seq = h.seq
|
||||||
join household h on rhh.household_seq = h.seq
|
join researcher_has_household rhh on rhh.household_seq = h.seq and rhh.is_deleted = false
|
||||||
join admin a on a.seq = rhh.admin_seq
|
|
||||||
where rhv.is_deleted = false
|
where rhv.is_deleted = false
|
||||||
<if test="seq > 0">
|
<if test="seq > 0">
|
||||||
and rhh.admin_seq = #{seq}
|
and rhh.admin_seq = #{seq}
|
||||||
@@ -134,6 +133,66 @@
|
|||||||
LIMIT #{size} OFFSET #{page}*#{size}
|
LIMIT #{size} OFFSET #{page}*#{size}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectVisitHouseholdPercentage">
|
||||||
|
with visit_ranking AS (
|
||||||
|
select
|
||||||
|
hv.household_seq,
|
||||||
|
hv.visit_date,
|
||||||
|
hv.is_gift_sent,
|
||||||
|
ROW_NUMBER() OVER (PARTITION BY hv.household_seq ORDER BY hv.visit_date ASC) AS visit_rank
|
||||||
|
from household_visit hv
|
||||||
|
where TO_CHAR(hv.visit_date, 'YYYYMM') = #{searchMonth}
|
||||||
|
and hv.is_deleted = FALSE
|
||||||
|
),
|
||||||
|
visit_counts AS (
|
||||||
|
select
|
||||||
|
COUNT(DISTINCT CASE WHEN vr.visit_rank = 1 THEN vr.household_seq END) AS first_visit_count,
|
||||||
|
COUNT(DISTINCT CASE WHEN vr.visit_rank = 2 THEN vr.household_seq END) AS second_visit_count,
|
||||||
|
COUNT(DISTINCT CASE WHEN vr.is_gift_sent = true THEN vr.household_seq END) AS gift_sent_count
|
||||||
|
from researcher_has_household rhh
|
||||||
|
left join visit_ranking vr ON rhh.household_seq = vr.household_seq
|
||||||
|
where rhh.is_deleted = false
|
||||||
|
and rhh.admin_seq = #{seq}
|
||||||
|
),
|
||||||
|
total_households AS (
|
||||||
|
select COUNT(DISTINCT rhh.household_seq) AS total_household_count
|
||||||
|
from researcher_has_household rhh
|
||||||
|
where rhh.is_deleted = false
|
||||||
|
AND rhh.admin_seq = #{seq}
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
th.total_household_count ,
|
||||||
|
vc.first_visit_count,
|
||||||
|
vc.second_visit_count,
|
||||||
|
vc.gift_sent_count,
|
||||||
|
ROUND(
|
||||||
|
CASE
|
||||||
|
WHEN th.total_household_count > 0
|
||||||
|
THEN (vc.first_visit_count::NUMERIC / th.total_household_count) * 100
|
||||||
|
ELSE 0
|
||||||
|
END,
|
||||||
|
2
|
||||||
|
) AS first_visit_percentage,
|
||||||
|
ROUND(
|
||||||
|
CASE
|
||||||
|
WHEN th.total_household_count > 0
|
||||||
|
THEN (vc.second_visit_count::NUMERIC / th.total_household_count) * 100
|
||||||
|
ELSE 0
|
||||||
|
END,
|
||||||
|
2
|
||||||
|
) AS second_visit_percentage,
|
||||||
|
ROUND(
|
||||||
|
CASE
|
||||||
|
WHEN th.total_household_count > 0
|
||||||
|
THEN (vc.gift_sent_count::NUMERIC / th.total_household_count) * 100
|
||||||
|
ELSE 0
|
||||||
|
END,
|
||||||
|
2
|
||||||
|
) AS gift_sent_percentage
|
||||||
|
FROM total_households th
|
||||||
|
CROSS JOIN visit_counts vc
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="visitHouseholdListCountAll">
|
<select id="visitHouseholdListCountAll">
|
||||||
select count(*)
|
select count(*)
|
||||||
from household_visit rhv
|
from household_visit rhv
|
||||||
|
|||||||
@@ -211,7 +211,9 @@ uiUtil.uploadFile = (fileUploadType, input) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const inputGroup = $(input).parent('.input-group');
|
|
||||||
|
const inputGroup = $(input).parent().parent().find('.input-group');
|
||||||
|
|
||||||
if (!inputGroup.length) {
|
if (!inputGroup.length) {
|
||||||
alert(
|
alert(
|
||||||
`${input.name} 앨리먼트의 부모가 input-group 클래스를 가져야 uiUtil.uploadFile 메서드를 실행할 수 있습니다.`);
|
`${input.name} 앨리먼트의 부모가 input-group 클래스를 가져야 uiUtil.uploadFile 메서드를 실행할 수 있습니다.`);
|
||||||
@@ -246,11 +248,11 @@ uiUtil.uploadFile = (fileUploadType, input) => {
|
|||||||
inputGroup.find('.invalid-feedback').text('');
|
inputGroup.find('.invalid-feedback').text('');
|
||||||
|
|
||||||
// 기존 mappingId 가 있다면 초기화
|
// 기존 mappingId 가 있다면 초기화
|
||||||
inputGroup.find('input[name=fileMappingId]').remove();
|
/* inputGroup.find('input[name=fileMappingId]').remove();*/
|
||||||
|
|
||||||
// 신규 mappingId 추가
|
/* // 신규 mappingId 추가
|
||||||
inputGroup.append(
|
inputGroup.append(
|
||||||
`<input type="hidden" name="fileMappingId" value="${res.id}"/>`);
|
`<input type="hidden" name="fileMappingId" value="${res.id}"/>`);*/
|
||||||
|
|
||||||
// 업로드 파일 정보 보이기
|
// 업로드 파일 정보 보이기
|
||||||
uiUtil.showFileInfo(input, res, $(input).attr('accept') === 'image/*');
|
uiUtil.showFileInfo(input, res, $(input).attr('accept') === 'image/*');
|
||||||
@@ -274,18 +276,16 @@ uiUtil.uploadFile = (fileUploadType, input) => {
|
|||||||
* @param {boolean} showImg 미리보기 이미지 노출 여부
|
* @param {boolean} showImg 미리보기 이미지 노출 여부
|
||||||
*/
|
*/
|
||||||
uiUtil.showFileInfo = (input, uploadFile, showImg) => {
|
uiUtil.showFileInfo = (input, uploadFile, showImg) => {
|
||||||
const inputGroup = $(input).parent('.input-group');
|
const inputGroup = $(input).parent().parent().find('.input-group');
|
||||||
if (!inputGroup.length) {
|
if (!inputGroup.length) {
|
||||||
alert(
|
alert(
|
||||||
`${input.name} 앨리먼트의 부모가 input-group 클래스를 가져야 showFileInfo 메서드를 실행할 수 있습니다.`);
|
`${input.name} 앨리먼트의 부모가 input-group 클래스를 가져야 showFileInfo 메서드를 실행할 수 있습니다.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
inputGroup.find('.fileInfo').remove();
|
/* inputGroup.find('.fileInfo').remove();*/
|
||||||
|
|
||||||
|
/* inputGroup.append(`
|
||||||
|
|
||||||
inputGroup.append(`
|
|
||||||
<div class="fileInfo row text-muted fw-normal" style="display: none">
|
<div class="fileInfo row text-muted fw-normal" style="display: none">
|
||||||
<img src="${showImg ? uploadFile.referURL : ''}" class="w-75 mt-3 mb-3"/>
|
<img src="${showImg ? uploadFile.referURL : ''}" class="w-75 mt-3 mb-3"/>
|
||||||
<ul class="row" style="margin-left: 10px;">
|
<ul class="row" style="margin-left: 10px;">
|
||||||
@@ -295,31 +295,28 @@ uiUtil.showFileInfo = (input, uploadFile, showImg) => {
|
|||||||
<li class="id">File ID (${uploadFile.id})<span class="btn-sm btn-link fw-bold resetFile" style="cursor:pointer;">삭제</span> </li>
|
<li class="id">File ID (${uploadFile.id})<span class="btn-sm btn-link fw-bold resetFile" style="cursor:pointer;">삭제</span> </li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);*/
|
||||||
|
|
||||||
|
inputGroup.append(`
|
||||||
|
<li class="fileInfo" style="display: none;">
|
||||||
|
<p><a href="${uploadFile.attachmentURL}">${uploadFile.originName}(${Math.ceil(uploadFile.fileLength / 1024)}KB)</a></p>
|
||||||
|
<button type="button" class="btn-delete resetFile"><span class="hide-txt ">삭제</span></button>
|
||||||
|
<input type="hidden" name="fileMappingId" value="${uploadFile.id}" />
|
||||||
|
</li>`);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const fileInfo = inputGroup.find('.fileInfo');
|
const fileInfo = inputGroup.find('.fileInfo');
|
||||||
if (!showImg) {
|
/* if (!showImg) {
|
||||||
fileInfo.find('img').remove();
|
fileInfo.find('img').remove();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// 파일 삭제 함수 정의
|
// 파일 삭제 함수 정의
|
||||||
inputGroup.find('.resetFile').on('click', () => {
|
inputGroup.find('.resetFile').on('click', function () {
|
||||||
let fileInput = inputGroup.find('input[type=file]');
|
const $fileInfo = $(this).closest('.fileInfo');
|
||||||
fileInput.replaceWith(`
|
$fileInfo.fadeOut(function () {
|
||||||
<input type="file"
|
$(this).remove();
|
||||||
id="${fileInput.attr('id')}"
|
|
||||||
class="${fileInput.attr('class')}"
|
|
||||||
accept="${fileInput.attr('accept')}"
|
|
||||||
name="${fileInput.attr('name')}"
|
|
||||||
onchange="${fileInput.attr('onchange')}">
|
|
||||||
`);
|
|
||||||
|
|
||||||
inputGroup.find('input[name=fileMappingId]').remove();
|
|
||||||
inputGroup.find('.fileInfo').fadeOut((evt) => {
|
|
||||||
$(evt.target).remove();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,11 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>제목<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
<th>제목<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<input type="text" name="title" id="title" placeholder="">
|
<input type="text" name="title" id="title" placeholder="">
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -28,20 +28,28 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>첨부파일<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
<th>첨부파일</th>
|
||||||
<td colspan="3">
|
<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);" >
|
||||||
|
<span class="file-txt">파일첨부</span>
|
||||||
|
</label>
|
||||||
|
<p class="desc">첨부 가능 파일 형식: 문서(pdf, docx, xlsx, pptx, hwp), 이미지(jpg, jpeg, png, gif), 기타(zip,
|
||||||
|
csv, txt) / 파일당 최대 5MB까지 등록 가능합니다.</p>
|
||||||
|
<ul class="file-list input-group" id="noticeAttachments">
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<!-- <td colspan="3">
|
||||||
<div class="btns-row align-left publicFileInputs">
|
<div class="btns-row align-left publicFileInputs">
|
||||||
<button type="button" class="btn btn-secondary" onclick="addFileInput();">
|
<button type="button" class="btn btn-secondary" onclick="addFileInput();">
|
||||||
<span class="btn-txt">다건 파일 첨부</span>
|
<span class="btn-txt">다건 파일 첨부</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</td>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>게시기간<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
<th>게시기간<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
@@ -57,11 +65,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>노출여부<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
<th>노출여부<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
<td>
|
<td>
|
||||||
@@ -75,8 +81,6 @@
|
|||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@@ -102,7 +106,6 @@
|
|||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
|
||||||
|
|
||||||
$(".flatpickr").flatpickr({
|
$(".flatpickr").flatpickr({
|
||||||
dateFormat: "Y-m-d\\TH:i",
|
dateFormat: "Y-m-d\\TH:i",
|
||||||
// altInput: true,
|
// altInput: true,
|
||||||
@@ -111,6 +114,7 @@
|
|||||||
enableTime: true,
|
enableTime: true,
|
||||||
time_24hr: true
|
time_24hr: true
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
@@ -120,13 +124,11 @@
|
|||||||
history.back();
|
history.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const gotoList = () => {
|
const gotoList = () => {
|
||||||
location.href = '/communication/notices';
|
location.href = '/communication/notices';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* function addFileInput() {
|
||||||
function addFileInput() {
|
|
||||||
const inputGroup = $(`
|
const inputGroup = $(`
|
||||||
<div class="input-group w-50">
|
<div class="input-group w-50">
|
||||||
<input class="form-control mb-2" type="file" name="multipartAttachments"
|
<input class="form-control mb-2" type="file" name="multipartAttachments"
|
||||||
@@ -142,7 +144,7 @@
|
|||||||
return inputGroup;
|
return inputGroup;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
const getNotice = () => {
|
const getNotice = () => {
|
||||||
const f = document.reqForm;
|
const f = document.reqForm;
|
||||||
@@ -167,11 +169,10 @@
|
|||||||
f.visible.value = res.visible;
|
f.visible.value = res.visible;
|
||||||
|
|
||||||
res.uploadFiles.forEach((uploadFile) => {
|
res.uploadFiles.forEach((uploadFile) => {
|
||||||
|
let inputGroup = $('#noticeAttachments');
|
||||||
let inputGroup = addFileInput();
|
/* let inputGroup = addFileInput();
|
||||||
inputGroup.append(`<input type="hidden" name="fileMappingId" value="${uploadFile.id}"/>`);
|
inputGroup.append(`<input type="hidden" name="fileMappingId" value="${uploadFile.id}"/>`);*/
|
||||||
uiUtil.showFileInfo(inputGroup.find('input[type=file]'), uploadFile, false);
|
uiUtil.showFileInfo(inputGroup, uploadFile, false);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -180,9 +181,6 @@
|
|||||||
// 상세정보 얻기
|
// 상세정보 얻기
|
||||||
getNotice();
|
getNotice();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const goSave = () => {
|
const goSave = () => {
|
||||||
const f = document.reqForm;
|
const f = document.reqForm;
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,22 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="tab-content" data-tab-value="tab2" th:unless="${activeProfile != 'local'}">
|
<div class="tab-content" data-tab-value="tab2" th:unless="${activeProfile != 'local'}">
|
||||||
<div class="content-inner">
|
<div class="content-inner">
|
||||||
|
<article class="summary-area">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<p>당월 1차 방문</p>
|
||||||
|
<span><strong id="firstVisitCount">6</strong>/<strong class="totalHouseholdCount">6</strong>(<strong id="firstVisitPercentage">6</strong>%)</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>당월 2차 방문</p>
|
||||||
|
<span><strong id="secondVisitCount">6</strong>/<strong class="totalHouseholdCount">6</strong>(<strong id="secondVisitPercentage">6</strong>%)</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>답례품 전달</p>
|
||||||
|
<span><strong id="giftSentCount">6</strong>/<strong class="totalHouseholdCount">6</strong>(<strong id="giftSentPercentage">6</strong>%)</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</article>
|
||||||
<section class="table-group">
|
<section class="table-group">
|
||||||
<div class="table-tit-group">
|
<div class="table-tit-group">
|
||||||
<h3>총 <strong id="household-visit-totalElements"></strong>건</h3>
|
<h3>총 <strong id="household-visit-totalElements"></strong>건</h3>
|
||||||
@@ -108,24 +124,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table>
|
|
||||||
<thead>
|
<table>
|
||||||
<tr>
|
<thead>
|
||||||
<th>
|
<tr>
|
||||||
<input onchange="toggleCheckbox(this);" type="checkbox"/>
|
<th>
|
||||||
</th>
|
<input onchange="toggleCheckbox(this);" type="checkbox"/>
|
||||||
<th>임가번호</th>
|
</th>
|
||||||
<th>경영주명</th>
|
<th>임가번호</th>
|
||||||
<th>방문일</th>
|
<th>경영주명</th>
|
||||||
<th>관리분야</th>
|
<th>방문일</th>
|
||||||
<th>내용</th>
|
<th>관리분야</th>
|
||||||
<th>작성일</th>
|
<th>내용</th>
|
||||||
<th>답례품 전달</th>
|
<th>작성일</th>
|
||||||
</tr>
|
<th>답례품 전달</th>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody id="household-visit-list">
|
</thead>
|
||||||
</tbody>
|
<tbody id="household-visit-list">
|
||||||
</table>
|
</tbody>
|
||||||
|
</table>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -169,6 +186,7 @@
|
|||||||
if (!form.searchMonth.value) {
|
if (!form.searchMonth.value) {
|
||||||
form.searchMonth.value = '[[${currentMonth}]]'; // 기본값 복원
|
form.searchMonth.value = '[[${currentMonth}]]'; // 기본값 복원
|
||||||
}
|
}
|
||||||
|
getVisitHouseholdPercentage();
|
||||||
getHouseholdVisitList(0);
|
getHouseholdVisitList(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -241,6 +259,35 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 임가 방문 퍼센트
|
||||||
|
const getVisitHouseholdPercentage=()=>{
|
||||||
|
const f = document.householdReqForm;
|
||||||
|
|
||||||
|
let dataObj = {
|
||||||
|
seq: f.seq.value,
|
||||||
|
searchMonth: f.searchMonth.value,
|
||||||
|
};
|
||||||
|
ajaxUtil._ajaxMethod(
|
||||||
|
'/api/researcher/visitHousehold/percentage',
|
||||||
|
dataObj,
|
||||||
|
function (response) {
|
||||||
|
$('#firstVisitCount').text(response.firstVisitCount);
|
||||||
|
$('#secondVisitCount').text(response.secondVisitCount);
|
||||||
|
$('#giftSentCount').text(response.giftSentCount);
|
||||||
|
$('#firstVisitPercentage').text(response.firstVisitPercentage);
|
||||||
|
$('#secondVisitPercentage').text(response.secondVisitPercentage);
|
||||||
|
$('#giftSentPercentage').text(response.giftSentPercentage);
|
||||||
|
$('.totalHouseholdCount').text(response.totalHouseholdCount);
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
|
||||||
|
},
|
||||||
|
'get',
|
||||||
|
'json',
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// 임가 방문 정보
|
// 임가 방문 정보
|
||||||
const getHouseholdVisitList = (pageNo) => {
|
const getHouseholdVisitList = (pageNo) => {
|
||||||
const f = document.householdReqForm;
|
const f = document.householdReqForm;
|
||||||
@@ -346,7 +393,7 @@
|
|||||||
JSON.stringify(selectIds),
|
JSON.stringify(selectIds),
|
||||||
function (response) {
|
function (response) {
|
||||||
if(response > 0){
|
if(response > 0){
|
||||||
alert('선택한 임가정보가 삭제되었습니다.');
|
alert('선택한 임가 방문 정보가 삭제되었습니다.');
|
||||||
getHouseholdVisitList(document.householdReqForm.page.value);
|
getHouseholdVisitList(document.householdReqForm.page.value);
|
||||||
} else {
|
} else {
|
||||||
alert('삭제에 실패했습니다.');
|
alert('삭제에 실패했습니다.');
|
||||||
|
|||||||
@@ -98,11 +98,15 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th> <label for="inUse">사용여부</label></th>
|
<th> <label for="inUse">사용여부</label></th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-select">
|
<div class="d-flex">
|
||||||
<select class="form-select" id="inUse" name="inUse">
|
<div class="component-input">
|
||||||
<option value="true">사용</option>
|
<div class="component-select">
|
||||||
<option value="false">미사용</option>
|
<select class="select-list" id="inUse" name="inUse">
|
||||||
</select>
|
<option value="true">사용</option>
|
||||||
|
<option value="false">미사용</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -231,13 +235,17 @@
|
|||||||
const previouslySelected = treeWrap.querySelector('button.selected');
|
const previouslySelected = treeWrap.querySelector('button.selected');
|
||||||
if (previouslySelected) {
|
if (previouslySelected) {
|
||||||
previouslySelected.classList.remove('selected');
|
previouslySelected.classList.remove('selected');
|
||||||
if (previouslySelected.classList.contains('tit')) {
|
/* if (previouslySelected.classList.contains('tit')) {
|
||||||
previouslySelected.parentNode.classList.add('folding');
|
previouslySelected.parentNode.classList.add('folding');
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
button.classList.add('selected');
|
button.classList.add('selected');
|
||||||
if (button.classList.contains('tit')) {
|
if (button.classList.contains('tit')) {
|
||||||
button.parentNode.classList.remove('folding');
|
if(button.parentNode.classList.contains('folding')){
|
||||||
|
button.parentNode.classList.remove('folding');
|
||||||
|
}else{
|
||||||
|
button.parentNode.classList.add('folding');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 노드 데이터 추출
|
// 노드 데이터 추출
|
||||||
const data = {
|
const data = {
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package app.module.core.config.application.util;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.entity.UploadFile;
|
||||||
|
import app.module.core.usecase.file.saveToStorage.ports.application.strategy.SftpConnector;
|
||||||
|
import com.jcraft.jsch.ChannelSftp;
|
||||||
|
import com.jcraft.jsch.JSchException;
|
||||||
|
import com.jcraft.jsch.SftpException;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SftpFileDeleteUtil {
|
||||||
|
|
||||||
|
private final SftpConnector sftpConnector;
|
||||||
|
|
||||||
|
@Value("${path.upload.sftp.public}")
|
||||||
|
private String publicPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SFTP 서버에서 파일을 삭제하는 공통 메서드
|
||||||
|
* @param deleteFile 삭제할 파일 정보
|
||||||
|
* @throws JSchException SFTP 연결 오류
|
||||||
|
* @throws SftpException SFTP 작업 오류
|
||||||
|
*/
|
||||||
|
public void deleteRealFile(UploadFile deleteFile) throws JSchException, SftpException {
|
||||||
|
if (deleteFile == null || deleteFile.getPath() == null || deleteFile.getName() == null) {
|
||||||
|
log.error("Invalid file information: {}", deleteFile);
|
||||||
|
throw new IllegalArgumentException("Invalid file information");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 경로 검증 및 생성
|
||||||
|
String filePath = constructSafeFilePath(deleteFile.getPath(), deleteFile.getName());
|
||||||
|
log.info("Attempting to delete file from SFTP: {}", filePath);
|
||||||
|
|
||||||
|
// SFTP 연결 확인 및 재연결
|
||||||
|
if (!sftpConnector.isConnected()) {
|
||||||
|
log.warn("SFTP connection lost, attempting to reconnect");
|
||||||
|
sftpConnector.connect();
|
||||||
|
}
|
||||||
|
ChannelSftp channelSftp = sftpConnector.getChannelSftp();
|
||||||
|
if (channelSftp == null) {
|
||||||
|
log.error("SFTP channel is not initialized");
|
||||||
|
throw new SftpException(ChannelSftp.SSH_FX_NO_CONNECTION, "SFTP channel is not initialized");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 파일 삭제
|
||||||
|
try {
|
||||||
|
channelSftp.stat(filePath); // 파일 존재 여부 확인
|
||||||
|
channelSftp.rm(filePath);
|
||||||
|
log.info("File deleted successfully from SFTP: {}", filePath);
|
||||||
|
} catch (SftpException e) {
|
||||||
|
if (e.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) {
|
||||||
|
log.warn("File does not exist on SFTP: {}", filePath);
|
||||||
|
} else {
|
||||||
|
log.error("Failed to delete file from SFTP: {}, error: {}", filePath, e.getMessage(), e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 경로 조작 방지를 위해 안전한 파일 경로 생성
|
||||||
|
*/
|
||||||
|
private String constructSafeFilePath(String subPath, String fileName) {
|
||||||
|
// 경로 및 파일 이름 정규화
|
||||||
|
String normalizedSubPath = Paths.get(subPath).normalize().toString().replace("\\", "/");
|
||||||
|
String normalizedFileName = Paths.get(fileName).getFileName().toString();
|
||||||
|
String safePath = CommonUtil.removeLastChar(publicPath, "/") + "/" + normalizedSubPath + "/" + normalizedFileName;
|
||||||
|
|
||||||
|
// 경로가 publicPath로 시작하는지 검증
|
||||||
|
if (!safePath.startsWith(publicPath)) {
|
||||||
|
log.error("Invalid file path detected: {}", safePath);
|
||||||
|
throw new IllegalArgumentException("Invalid file path: " + safePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return safePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user