Merge branch 'susu' into dev
This commit is contained in:
@@ -21,4 +21,9 @@ public interface ResearcherMapper {
|
|||||||
List<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
List<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
||||||
Long visitHouseholdListCountAll(ResearchersDetailReqVO reqVO);
|
Long visitHouseholdListCountAll(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);
|
||||||
|
Integer insertHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("createdBy") String createdBy);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import app.module.admin.usecase.researcher.persistence.model.ResearchersDto;
|
|||||||
import app.module.admin.usecase.researcher.persistence.model.ResearchersHouseholdVisitDto;
|
import app.module.admin.usecase.researcher.persistence.model.ResearchersHouseholdVisitDto;
|
||||||
import app.module.admin.usecase.researcher.persistence.model.ResearchersMappingHouseholdDto;
|
import app.module.admin.usecase.researcher.persistence.model.ResearchersMappingHouseholdDto;
|
||||||
import app.module.admin.usecase.researcher.web.model.HouseholdSearchReqVO;
|
import app.module.admin.usecase.researcher.web.model.HouseholdSearchReqVO;
|
||||||
import app.module.admin.usecase.researcher.web.model.MappingHouseholdListUIReqVO;
|
import app.module.admin.usecase.researcher.web.model.MappingHouseholdListReqVO;
|
||||||
import app.module.admin.usecase.researcher.web.model.ResearchersDetailReqVO;
|
import app.module.admin.usecase.researcher.web.model.ResearchersDetailReqVO;
|
||||||
import app.module.admin.usecase.researcher.web.model.ResearchersListReqVO;
|
import app.module.admin.usecase.researcher.web.model.ResearchersListReqVO;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -20,4 +20,5 @@ public interface ResearcherService {
|
|||||||
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
||||||
Integer visitHouseholdDelete(List<Integer> selectIds);
|
Integer visitHouseholdDelete(List<Integer> selectIds);
|
||||||
Page<GetHouseholdsStatus> searchMappingHousehold(HouseholdSearchReqVO reqVO);
|
Page<GetHouseholdsStatus> searchMappingHousehold(HouseholdSearchReqVO reqVO);
|
||||||
|
Integer updateMappingHousehold(MappingHouseholdListReqVO reqVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import app.module.admin.usecase.researcher.persistence.model.ResearchersDto;
|
|||||||
import app.module.admin.usecase.researcher.persistence.model.ResearchersHouseholdVisitDto;
|
import app.module.admin.usecase.researcher.persistence.model.ResearchersHouseholdVisitDto;
|
||||||
import app.module.admin.usecase.researcher.persistence.model.ResearchersMappingHouseholdDto;
|
import app.module.admin.usecase.researcher.persistence.model.ResearchersMappingHouseholdDto;
|
||||||
import app.module.admin.usecase.researcher.web.model.HouseholdSearchReqVO;
|
import app.module.admin.usecase.researcher.web.model.HouseholdSearchReqVO;
|
||||||
import app.module.admin.usecase.researcher.web.model.MappingHouseholdListUIReqVO;
|
import app.module.admin.usecase.researcher.web.model.MappingHouseholdListReqVO;
|
||||||
import app.module.admin.usecase.researcher.web.model.ResearchersDetailReqVO;
|
import app.module.admin.usecase.researcher.web.model.ResearchersDetailReqVO;
|
||||||
import app.module.admin.usecase.researcher.web.model.ResearchersListReqVO;
|
import app.module.admin.usecase.researcher.web.model.ResearchersListReqVO;
|
||||||
import app.module.core.config.application.util.CommonUtil;
|
import app.module.core.config.application.util.CommonUtil;
|
||||||
@@ -77,4 +77,16 @@ public class ResearcherServiceImpl implements ResearcherService {
|
|||||||
return new PageImpl<>(householdsStatus, pageable,
|
return new PageImpl<>(householdsStatus, pageable,
|
||||||
householdsStatus.isEmpty() ? 0 : householdsStatus.get(0).getTotal());
|
householdsStatus.isEmpty() ? 0 : householdsStatus.get(0).getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer updateMappingHousehold(MappingHouseholdListReqVO reqVO) {
|
||||||
|
int i = 0;
|
||||||
|
String deletedBy = CommonUtil.getLoginUsername();
|
||||||
|
for(Integer householdSeq : reqVO.getSelectedIds()) {
|
||||||
|
researcherMapper.deleteHouseholdResearcherMapping(reqVO.getResearcherSeq(), householdSeq,deletedBy);
|
||||||
|
i += researcherMapper.insertHouseholdResearcherMapping(reqVO.getResearcherSeq(), householdSeq,deletedBy);
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,10 +69,8 @@ class ResearcherController {
|
|||||||
return ResponseEntity.status(HttpStatus.OK).body(researcherService.searchMappingHousehold(reqVO));
|
return ResponseEntity.status(HttpStatus.OK).body(researcherService.searchMappingHousehold(reqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/mappingHousehold/")
|
@PostMapping("/mappingHousehold/update")
|
||||||
@ResponseBody
|
ResponseEntity<?> updateMappingHousehold(@RequestBody MappingHouseholdListReqVO reqVO ) {
|
||||||
public String registerSurveyor(@RequestParam("surveyorId") String surveyorId) {
|
return ResponseEntity.status(HttpStatus.OK).body(researcherService.updateMappingHousehold(reqVO));
|
||||||
//surveyorService.registerSurveyor(surveyorId);
|
|
||||||
return "success";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.module.admin.usecase.researcher.web.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class MappingHouseholdListReqVO {
|
||||||
|
private List<Integer> selectedIds;
|
||||||
|
private Integer researcherSeq;
|
||||||
|
}
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package app.module.admin.usecase.researcher.web.model;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public class MappingHouseholdListUIReqVO {
|
|
||||||
private Integer page;
|
|
||||||
private Integer size;
|
|
||||||
private String searchRegionMainCode;
|
|
||||||
|
|
||||||
public Integer getPage() {
|
|
||||||
// 요청 페이지 넘버 - 초기값 `0`
|
|
||||||
return page != null ? page : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSize() {
|
|
||||||
// 페이지 당 아이템 수 - 초기값 `10`
|
|
||||||
return size != null ? size : 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -83,16 +83,16 @@
|
|||||||
im.code_text AS industry_middle_code_name,
|
im.code_text AS industry_middle_code_name,
|
||||||
case h.is_panel when false then '유지' when true then '탈락' end panel_flag
|
case h.is_panel when false then '유지' when true then '탈락' end panel_flag
|
||||||
from household h
|
from household h
|
||||||
join admin_has_role ahr ON h.seq = ahr.admin_seq
|
join researcher_has_household rhh ON h.seq = rhh.household_seq and rhh.is_deleted = false
|
||||||
left join uicode rm ON rm.parent_id = 'code.region.main' AND rm.id = h.region_main_code
|
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 rs ON rs.parent_id = 'code.region.sub' AND rs.id = h.region_sub_code
|
||||||
left join uicode rd ON rd.parent_id = 'code.region.detail' AND rd.id = h.region_detail_code
|
left join uicode rd ON rd.parent_id = 'code.region.detail' AND 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 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 im ON im.parent_id = 'code.industry.middle' AND im.id = h.industry_middle_code
|
||||||
where ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
|
where 1=1
|
||||||
<if test="seq > 0">
|
<if test="seq > 0">
|
||||||
and ahr.admin_seq = #{seq}
|
and rhh.admin_seq = #{seq}
|
||||||
</if>
|
</if>
|
||||||
LIMIT #{size} OFFSET #{page}*#{size}
|
LIMIT #{size} OFFSET #{page}*#{size}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -100,10 +100,10 @@
|
|||||||
select
|
select
|
||||||
count(*)
|
count(*)
|
||||||
from household h
|
from household h
|
||||||
join admin_has_role ahr ON h.seq = ahr.admin_seq
|
join researcher_has_household rhh ON h.seq = rhh.household_seq and rhh.is_deleted = false
|
||||||
where ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
|
where 1=1
|
||||||
<if test="seq > 0">
|
<if test="seq > 0">
|
||||||
and ahr.admin_seq = #{seq}
|
and rhh.admin_seq = #{seq}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -155,4 +155,31 @@
|
|||||||
</foreach>)
|
</foreach>)
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="deleteHouseholdResearcherMapping">
|
||||||
|
update researcher_has_household
|
||||||
|
set is_deleted = true,
|
||||||
|
deleted_at = NOW(),
|
||||||
|
deleted_by = #{deletedBy}
|
||||||
|
where household_seq = #{householdSeq}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="insertHouseholdResearcherMapping">
|
||||||
|
insert into researcher_has_household(
|
||||||
|
id,
|
||||||
|
admin_seq,
|
||||||
|
household_seq,
|
||||||
|
created_at,
|
||||||
|
created_by,
|
||||||
|
updated_at,
|
||||||
|
updated_by
|
||||||
|
)values(
|
||||||
|
nextval('household_has_role_seq'),
|
||||||
|
#{researcherSeq},
|
||||||
|
#{householdSeq},
|
||||||
|
NOW(),
|
||||||
|
#{createdBy},
|
||||||
|
NOW(),
|
||||||
|
#{createdBy}
|
||||||
|
)
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -15,8 +15,10 @@
|
|||||||
<section class="filter-wrap">
|
<section class="filter-wrap">
|
||||||
<div class="form-area">
|
<div class="form-area">
|
||||||
<form autocomplete="off" method="get" name="reqHouseholdForm" id="reqHouseholdForm">
|
<form autocomplete="off" method="get" name="reqHouseholdForm" id="reqHouseholdForm">
|
||||||
<input name="page" th:field="*{reqVO.page}" type="hidden"/>
|
<input type="hidden" name="page" th:field="*{reqVO.page}"/>
|
||||||
|
<input type="hidden" name="researcherSeq" id="researcherSeq" th:value="${researcherSeq}">
|
||||||
<input type="hidden" name="regionMainCode" th:value="${regionMainCode}">
|
<input type="hidden" name="regionMainCode" th:value="${regionMainCode}">
|
||||||
|
<input type="hidden" name="researcherName" id="researcherName" th:value="${researcherName}">
|
||||||
<!-- 경영주 -->
|
<!-- 경영주 -->
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-label">
|
<div class="input-label">
|
||||||
@@ -141,8 +143,11 @@
|
|||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
const showHouseholdModal = (button) => {
|
const showHouseholdModal = (button) => {
|
||||||
// 버튼의 data-region-main-code 속성에서 regionMainCode 가져오기
|
|
||||||
const regionMainCode = button.getAttribute('data-region-main-code') || '';
|
const regionMainCode = button.getAttribute('data-region-main-code') || '';
|
||||||
|
const researcherSeq = button.getAttribute('data-researcher-seq') || '';
|
||||||
|
const researcherName = button.getAttribute('data-researcher-name') || '';
|
||||||
|
$('#researcherSeq').val(researcherSeq);
|
||||||
|
$('#researcherName').val(researcherName);
|
||||||
const existingModal = document.querySelector("#mappingHouseholdModal");
|
const existingModal = document.querySelector("#mappingHouseholdModal");
|
||||||
if (existingModal) {
|
if (existingModal) {
|
||||||
existingModal.remove();
|
existingModal.remove();
|
||||||
@@ -183,10 +188,10 @@
|
|||||||
$(response.content).each((idx, ct) => {
|
$(response.content).each((idx, ct) => {
|
||||||
tbody.append(
|
tbody.append(
|
||||||
`
|
`
|
||||||
<tr data-id="${ct.id}">
|
<tr data-id="${ct.householdSeq}">
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.seq}"/>
|
<input class="form-check-input" name="householdSelect" type="checkbox" value="${ct.householdSeq}"/>
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
<td>${ct.householdNum}</td>
|
<td>${ct.householdNum}</td>
|
||||||
@@ -221,7 +226,7 @@
|
|||||||
const registerHouseholds = () => {
|
const registerHouseholds = () => {
|
||||||
const selectedIds = [];
|
const selectedIds = [];
|
||||||
$('input[name="householdSelect"]:checked').each(function () {
|
$('input[name="householdSelect"]:checked').each(function () {
|
||||||
selectedIds.push($(this).val());
|
selectedIds.push(Number($(this).val()));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (selectedIds.length === 0) {
|
if (selectedIds.length === 0) {
|
||||||
@@ -229,21 +234,31 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ajaxUtil._ajaxMethod(
|
if(confirm("총 "+selectedIds.length+"건에 대하여 조사원을 "+$('#researcherName').val()+"으로 설정하시겠습니까?")) {
|
||||||
'/researcher/mappingHousehold/search',
|
|
||||||
{ regionMainCode: regionMainCode },
|
|
||||||
function (response) {
|
|
||||||
$("#mappingHouseholdModal").append(response);
|
|
||||||
// 모달 표시
|
|
||||||
|
|
||||||
},
|
const data = {
|
||||||
function (code, rstData) {
|
selectedIds: selectedIds,
|
||||||
alert('임가 등록에 실패했습니다.');
|
researcherSeq: $('#researcherSeq').val()
|
||||||
},
|
};
|
||||||
'get',
|
|
||||||
'json',
|
ajaxUtil._ajaxMethod(
|
||||||
null
|
'/researcher/mappingHousehold/update',
|
||||||
);
|
JSON.stringify(data),
|
||||||
|
function (response) {
|
||||||
|
if (response === selectedIds.length) {
|
||||||
|
alert('맵핑 완료되었습니다.');
|
||||||
|
}
|
||||||
|
document.querySelector(".modal01").ui.close();
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
alert('임가 맵핑에 실패했습니다.');
|
||||||
|
document.querySelector(".modal01").ui.close();
|
||||||
|
},
|
||||||
|
'post',
|
||||||
|
'json',
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div id="researcher-tab1" >
|
<div id="researcher-tab1" >
|
||||||
<button type="button" class="btn" th:data-region-main-code="${researcherDto.regionMainCode}" onclick="showHouseholdModal(this)">
|
<button type="button" class="btn" th:data-researcher-seq="${researcherDto.seq}" th:data-region-main-code="${researcherDto.regionMainCode}" th:data-researcher-name="${researcherDto.name}" onclick="showHouseholdModal(this)">
|
||||||
<span class="btn-txt">임가매핑</span>
|
<span class="btn-txt">임가매핑</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -236,7 +236,6 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 임가 방문 정보
|
// 임가 방문 정보
|
||||||
const getHouseholdVisitList = (pageNo) => {
|
const getHouseholdVisitList = (pageNo) => {
|
||||||
const f = document.householdReqForm;
|
const f = document.householdReqForm;
|
||||||
@@ -359,10 +358,6 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user