[BO] 수정 반영
This commit is contained in:
@@ -43,8 +43,10 @@ class UpdateNoticeController {
|
||||
updateFilePortIn.operate(
|
||||
new UpdateFileCmd(
|
||||
reqVO.getId(),
|
||||
reqVO.getFileMappingId().stream().map(Long::parseLong).toList(),
|
||||
FileUploadType.NOTICE)
|
||||
reqVO.getFileMappingId() != null
|
||||
? reqVO.getFileMappingId().stream().map(Long::parseLong).toList()
|
||||
: List.of(),
|
||||
FileUploadType.NOTICE)
|
||||
);
|
||||
|
||||
updateNoticePortIn.operate(
|
||||
|
||||
@@ -10,19 +10,24 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class SaveHouseholdVisitInfoDao implements SaveHouseholdVisitInfoPortOut {
|
||||
private final SaveHouseholdVisitInfoMapper mapper;
|
||||
private final SaveHouseholdVisitInfoMapper mapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void operate(SaveHouseholdVisitInfoCmd cmd) {
|
||||
if (cmd.getVisitInfoId() != null) {
|
||||
mapper.findById(cmd.getHouseholdSeq())
|
||||
.ifPresentOrElse(
|
||||
v -> mapper.updateHouseholdVisitInfo(AuditUtil.update(cmd)),
|
||||
() -> { throw new IllegalArgumentException("방문정보가 없습니다."); }
|
||||
);
|
||||
} else {
|
||||
mapper.createHouseholdVisitInfo(AuditUtil.create(cmd));
|
||||
@Override
|
||||
@Transactional
|
||||
public void operate(SaveHouseholdVisitInfoCmd cmd) {
|
||||
// 답례품 전달 완료일 경우 기존 방문들 중 true → false로 변경
|
||||
if (Boolean.TRUE.equals(cmd.getIsGiftSent())) {
|
||||
mapper.updateGiftSentToFalse(AuditUtil.update(cmd));
|
||||
}
|
||||
|
||||
if (cmd.getVisitInfoId() != null) {
|
||||
mapper.findById(cmd.getHouseholdSeq())
|
||||
.ifPresentOrElse(v -> mapper.updateHouseholdVisitInfo(AuditUtil.update(cmd)),
|
||||
() -> {
|
||||
throw new IllegalArgumentException("방문정보가 없습니다.");
|
||||
});
|
||||
} else {
|
||||
mapper.createHouseholdVisitInfo(AuditUtil.create(cmd));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,6 @@ public interface SaveHouseholdVisitInfoMapper {
|
||||
Optional<Long> findById(Long id);
|
||||
void createHouseholdVisitInfo(SaveHouseholdVisitInfoCmd cmd);
|
||||
void updateHouseholdVisitInfo(SaveHouseholdVisitInfoCmd cmd);
|
||||
void updateGiftSentToFalse(SaveHouseholdVisitInfoCmd cmd);
|
||||
|
||||
}
|
||||
|
||||
@@ -67,6 +67,10 @@ public class ResearcherDao implements ResearcherPortOut {
|
||||
@Override
|
||||
@UpdateCommand
|
||||
public Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO) {
|
||||
if(Boolean.TRUE.equals(reqVO.getIsGiftSent())) {
|
||||
researcherMapper.updateGiftSentToFalse(reqVO);
|
||||
}
|
||||
|
||||
return researcherMapper.updateVisitHousehold(reqVO);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ public interface ResearcherMapper {
|
||||
List<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
||||
ResearchersHouseholdVisitDto visitHouseholdDetail(Integer id);
|
||||
Long visitHouseholdListCountAll(ResearchersDetailReqVO reqVO);
|
||||
void updateGiftSentToFalse(ResearchersVisitDetailReqVO reqVO);
|
||||
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
||||
VisitHouseholdPercentageDto selectVisitHouseholdPercentage(ResearchersDetailReqVO reqVO);
|
||||
Integer visitHouseholdDelete(@Param("selectIds") List<Integer> selectIds,@Param("deletedBy") String deletedBy);
|
||||
|
||||
@@ -12,8 +12,9 @@ import java.time.LocalDateTime;
|
||||
@Setter
|
||||
public class ResearchersVisitDetailReqVO extends AuditCommand {
|
||||
private Integer id;
|
||||
private Long householdSeq;
|
||||
private LocalDate visitDate;
|
||||
private ManagementType managementType;
|
||||
private String content;
|
||||
private String isGiftSent;
|
||||
private Boolean isGiftSent;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
WHERE household_seq = #{householdSeq}
|
||||
AND TO_CHAR(visit_date, 'YYYYMM') = #{recordMonth}
|
||||
AND hv.is_deleted = false
|
||||
ORDER BY hv.created_at
|
||||
ORDER BY hv.visit_date
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -37,6 +37,17 @@
|
||||
WHERE id = #{visitInfoId}
|
||||
</update>
|
||||
|
||||
<update id="updateGiftSentToFalse">
|
||||
/* updateGiftSentToFalse : 동일 household_seq 의 다른 방문 중 전달여부 true → false */
|
||||
UPDATE household_visit
|
||||
SET is_gift_sent = false
|
||||
WHERE household_seq = #{householdSeq}
|
||||
AND TO_CHAR(visit_date, 'YYYYMM') = TO_CHAR(TO_DATE(#{visitDate}, 'YYYY-MM-DD'), 'YYYYMM')
|
||||
AND is_gift_sent = true
|
||||
AND (#{visitInfoId} IS NULL OR id != #{visitInfoId})
|
||||
AND is_deleted = false
|
||||
</update>
|
||||
|
||||
<select id="findById" resultType="java.lang.Long">
|
||||
/* findById : 임가방문정보 조회 */
|
||||
SELECT id
|
||||
|
||||
@@ -106,11 +106,11 @@
|
||||
from household h
|
||||
join researcher_has_household rhh ON h.seq = rhh.household_seq and rhh.is_deleted = false
|
||||
join admin a ON a.seq = rhh.admin_seq and a.is_deleted = false
|
||||
left join uicode rm ON rm.parent_id = 'code.region.main' AND rm.id = h.region_main_code
|
||||
left join uicode rs ON rs.parent_id = 'code.region.sub' AND rs.id = h.region_sub_code
|
||||
left join uicode rm ON rm.id = h.region_main_code
|
||||
left join uicode rs ON rs.id = h.region_sub_code
|
||||
left join uicode rd ON rd.id = h.region_detail_code
|
||||
left join uicode il ON il.parent_id = 'code.industry.large' AND il.id = h.industry_large_code
|
||||
left join uicode im ON im.parent_id = 'code.industry.middle' AND im.id = h.industry_middle_code
|
||||
left join uicode il ON il.id = h.industry_large_code
|
||||
left join uicode im ON im.id = h.industry_middle_code
|
||||
where 1=1
|
||||
<if test="seq > 0">
|
||||
and rhh.admin_seq = #{seq}
|
||||
@@ -156,6 +156,7 @@
|
||||
<if test="searchMonth != null and searchMonth != ''">
|
||||
and TO_CHAR(rhv.visit_date ,'YYYYMM')= #{searchMonth}
|
||||
</if>
|
||||
order by rhv.visit_date
|
||||
</select>
|
||||
|
||||
<select id="selectVisitHouseholdPercentage">
|
||||
@@ -245,6 +246,17 @@
|
||||
where rhv.is_deleted = false and rhv.id = #{id}
|
||||
</select>
|
||||
|
||||
<update id="updateGiftSentToFalse">
|
||||
/* updateGiftSentToFalse : 동일 household_seq 의 다른 방문 중 전달여부 true → false */
|
||||
UPDATE household_visit
|
||||
SET is_gift_sent = false
|
||||
WHERE household_seq = #{householdSeq}
|
||||
AND TO_CHAR(visit_date, 'YYYYMM') = TO_CHAR(#{visitDate}, 'YYYYMM')
|
||||
AND is_gift_sent = true
|
||||
AND (#{id} IS NULL OR id != #{id})
|
||||
AND is_deleted = false
|
||||
</update>
|
||||
|
||||
<update id="updateVisitHousehold">
|
||||
update household_visit
|
||||
set visit_date = #{visitDate},
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
<tbody id="mappingHousehold-list"></tbody>
|
||||
</table>
|
||||
<!-- 페이지네이션 -->
|
||||
<div class="row paging"></div>
|
||||
<div class="row mapping-paging"></div>
|
||||
|
||||
<!-- 등록 버튼 -->
|
||||
<div class="component-btns bottom-btn-group" th:fragment="modalButtons">
|
||||
@@ -133,7 +133,7 @@
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<button class="modal-close"></button>
|
||||
<button type="button" class="modal-close"></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -215,7 +215,7 @@
|
||||
`);
|
||||
});
|
||||
// Pagination 구성하기
|
||||
const paging = $('.paging');
|
||||
const paging = $('.mapping-paging');
|
||||
paging.empty();
|
||||
paging.append(
|
||||
uiUtil.getPagingUI(pageNo, response.size, response.totalPages,
|
||||
@@ -257,6 +257,7 @@
|
||||
function (response) {
|
||||
if (response === selectedIds.length) {
|
||||
alert('맵핑 완료되었습니다.');
|
||||
getHouseholdList(0);
|
||||
}
|
||||
document.querySelector(".modal01").ui.close();
|
||||
},
|
||||
|
||||
@@ -20,27 +20,21 @@
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt">
|
||||
검색필드
|
||||
공지사항
|
||||
</p>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" th:field="*{searchField}" id="searchField">
|
||||
<option value="all" selected>전체</option>
|
||||
<option value="title">제목</option>
|
||||
<option value="updatedBy">작성자</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt">
|
||||
검색필드
|
||||
</p>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="searchValue" th:field="*{searchValue}" placeholder="검색어를 입력하세요.">
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select class="select-list" required th:field="*{searchField}">
|
||||
<option value="all" selected>전체</option>
|
||||
<option value="title">제목</option>
|
||||
<option value="content">내용</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="searchValue" th:field="*{searchValue}" placeholder="검색어를 입력하세요." onkeypress="if(event.key === 'Enter') goSearch();">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -48,18 +42,17 @@
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt">
|
||||
검색필드
|
||||
노출여부
|
||||
</p>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" th:field="*{searchOpen}" id="searchOpen">
|
||||
<select class="select-list" th:field="*{searchOpen}" id="searchOpen">
|
||||
<option value="" selected>전체</option>
|
||||
<option value="true">Y</option>
|
||||
<option value="false">N</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 버튼 그룹 -->
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<p class="input-label" style="font-size: 16px; font-weight: bold;">내용</p>
|
||||
<div class="component-input">
|
||||
<div class="input-textarea-field">
|
||||
<textarea id="memo" name="memo" class="textarea" placeholder="" th:text="${item.content}"></textarea>
|
||||
<textarea id="memo" name="memo" class="textarea" placeholder="" th:text="${item.content}" readonly></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" class="datepicker-btn-trigger" name="visitDate" id="visitDate" aria-label="시작일"
|
||||
placeholder="시작일을 입력해주세요" />
|
||||
placeholder="방문일을 입력해주세요" />
|
||||
<span class="input-field-btn datepicker-state">
|
||||
<span class="hide-txt">달력</span>
|
||||
<i class="ico-calendar ico-normal" aria-hidden="true"></i>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<button type="button" class="btn small btn-secondary" onclick="showDeleteVisitInfoConfirm();">
|
||||
<span class=" btn-txt">삭제</span>
|
||||
</button>
|
||||
<button type="button" class="btn small btn-primary" onclick="showVisitInfoModal();">
|
||||
<button type="button" class="btn small btn-primary" id="visitAddBtn" onclick="showVisitInfoModal();">
|
||||
<span class="btn-txt">추가</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -54,6 +54,7 @@
|
||||
const tbody = $('.tab-content.household-visit tbody');
|
||||
|
||||
tbody.empty();
|
||||
$('#visitAddBtn').toggle(response.length < 2);
|
||||
|
||||
if(response.length === 0) {
|
||||
tbody.append(`<tr><td colspan="6" style="text-align: center;">등록이 필요합니다.</td></tr>`);
|
||||
|
||||
@@ -177,6 +177,12 @@
|
||||
</section>
|
||||
<th:block layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
const managementType = {
|
||||
VISIT: "방문조사",
|
||||
CALL: "전화상담",
|
||||
ETC: "기타"
|
||||
};
|
||||
|
||||
// 탭 클릭 시 함수 호출
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const tabButtons = document.querySelectorAll('.tab-label');
|
||||
@@ -325,9 +331,12 @@
|
||||
<td><a href="#" onclick="showHouseholdModal2(${ct.id});">${ct.householdNum}</a></td>
|
||||
<td>${ct.ownerName}</td>
|
||||
<td>${ct.visitDate}</td>
|
||||
<td>${ct.managementType}</td>
|
||||
<td>${managementType[ct.managementType]}</td>
|
||||
<td><a href="javascript:void(0);" class="ellipsis" style="text-decoration: none;">${ct.content}</a></td>
|
||||
<td>${ct.updatedAt}</td>
|
||||
<td>
|
||||
${ct.updatedBy}<br>
|
||||
(${ct.updatedAt})
|
||||
</td>
|
||||
<td>${ct.isGiftSentFlag}</td>
|
||||
</tr>
|
||||
`
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<section>
|
||||
<form autocomplete="off" method="get" name="householdVisitReqForm" >
|
||||
<input type="hidden" name="id" id="id" />
|
||||
<input type="hidden" name="householdSeq" id="householdSeq" />
|
||||
<table class="type-form confirm" >
|
||||
<colgroup>
|
||||
<col width="8%" />
|
||||
@@ -67,7 +68,7 @@
|
||||
<td class="radio-group">
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="is_gift_sent_y" name="isGiftSent">
|
||||
<input type="radio" id="is_gift_sent_y" name="isGiftSent" value="true">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">전달</span>
|
||||
</span>
|
||||
@@ -75,7 +76,7 @@
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="is_gift_sent_n" name="isGiftSent">
|
||||
<input type="radio" id="is_gift_sent_n" name="isGiftSent" value="false">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">미전달</span>
|
||||
</span>
|
||||
@@ -111,20 +112,6 @@
|
||||
const showHouseholdModal2 = (seq) => {
|
||||
const modal = document.querySelector(".modal02");
|
||||
modal.ui.open();
|
||||
const $el = document.querySelector('.component-datepicker');
|
||||
const datepicker = etUI.components.DatepickerComp();
|
||||
datepicker.core.init($el, {
|
||||
dateSelectCallback: function (selectedDate) {
|
||||
console.log('선택된 날짜:', selectedDate);
|
||||
}
|
||||
});
|
||||
|
||||
datepickerInstance = datepicker.getDatepickerInstance();
|
||||
|
||||
// 초기 상태 오늘 날짜로
|
||||
if (datepickerInstance) {
|
||||
datepickerInstance.setDate(new Date(), { render: true });
|
||||
}
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/researcher/visitHousehold/'+seq,
|
||||
@@ -149,12 +136,8 @@
|
||||
const setFormData = (data) => {
|
||||
// 폼 필드에 데이터 세팅
|
||||
const f = document.householdVisitReqForm;
|
||||
|
||||
// 날짜 세팅
|
||||
if (datepickerInstance && data.visitDate) {
|
||||
|
||||
console.log(data.visitDate);
|
||||
console.log(new Date(data.visitDate));
|
||||
|
||||
datepickerInstance.setDate(new Date(data.visitDate), { render: true });
|
||||
}
|
||||
|
||||
@@ -163,6 +146,7 @@
|
||||
}
|
||||
f.content.value = data.content;
|
||||
f.id.value = data.id;
|
||||
f.householdSeq.value = data.householdSeq;
|
||||
const isGift = data.isGiftSentFlag;
|
||||
if (isGift === "t") {
|
||||
document.getElementById('is_gift_sent_y').checked = true;
|
||||
@@ -244,6 +228,7 @@
|
||||
function (response) {
|
||||
alert('수정 완료되었습니다.');
|
||||
closeModal();
|
||||
getHouseholdVisitList();
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.error('Error updating data:', code, rstData);
|
||||
@@ -262,6 +247,28 @@
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<script>
|
||||
let datepickerInstance = null;
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const $el = document.querySelector('.component-datepicker');
|
||||
const datepicker = etUI.components.DatepickerComp();
|
||||
|
||||
datepicker.core.init($el, {
|
||||
dateSelectCallback: function (selectedDate) {
|
||||
console.log('선택된 날짜:', selectedDate);
|
||||
}
|
||||
});
|
||||
|
||||
datepickerInstance = datepicker.getDatepickerInstance();
|
||||
|
||||
// 초기 상태 오늘 날짜로
|
||||
if (datepickerInstance) {
|
||||
datepickerInstance.setDate(new Date(), { render: true });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</section>
|
||||
</div>
|
||||
</html>
|
||||
Reference in New Issue
Block a user