Merge branch 'dev' into 'kangsun'
# Conflicts: # admin/src/main/java/app/module/admin/usecase/researcher/service/ResearcherService.java
This commit is contained in:
@@ -21,4 +21,9 @@ public interface ResearcherMapper {
|
||||
List<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
||||
Long visitHouseholdListCountAll(ResearchersDetailReqVO reqVO);
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,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.ResearchersMappingHouseholdDto;
|
||||
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.ResearchersListReqVO;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
@@ -12,7 +12,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.ResearchersMappingHouseholdDto;
|
||||
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.ResearchersListReqVO;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
@@ -88,4 +88,16 @@ public class ResearcherServiceImpl implements ResearcherService {
|
||||
return new PageImpl<>(households, pageable,
|
||||
households.isEmpty() ? 0 : households.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));
|
||||
}
|
||||
|
||||
@PostMapping("/mappingHousehold/")
|
||||
@ResponseBody
|
||||
public String registerSurveyor(@RequestParam("surveyorId") String surveyorId) {
|
||||
//surveyorService.registerSurveyor(surveyorId);
|
||||
return "success";
|
||||
@PostMapping("/mappingHousehold/update")
|
||||
ResponseEntity<?> updateMappingHousehold(@RequestBody MappingHouseholdListReqVO reqVO ) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(researcherService.updateMappingHousehold(reqVO));
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ class UICodeSaveController {
|
||||
saveVO.getOrderNo(),
|
||||
saveVO.getCodeText(),
|
||||
saveVO.getCodeValue(),
|
||||
saveVO.getCodeType(),
|
||||
saveVO.getMsgCode(),
|
||||
saveVO.getInUse()),
|
||||
"create".equals(saveVO.getMode()));
|
||||
|
||||
@@ -24,6 +24,7 @@ public class UICodeSaveVO {
|
||||
private String codeText;
|
||||
@NotBlank(message = "{valid.common.required}")
|
||||
private String codeValue;
|
||||
private String codeType;
|
||||
private String msgCode;
|
||||
private Boolean inUse;
|
||||
private String mode;
|
||||
|
||||
@@ -83,16 +83,16 @@
|
||||
im.code_text AS industry_middle_code_name,
|
||||
case h.is_panel when false then '유지' when true then '탈락' end panel_flag
|
||||
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 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 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
|
||||
where ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
|
||||
<if test="seq > 0">
|
||||
and ahr.admin_seq = #{seq}
|
||||
</if>
|
||||
where 1=1
|
||||
<if test="seq > 0">
|
||||
and rhh.admin_seq = #{seq}
|
||||
</if>
|
||||
LIMIT #{size} OFFSET #{page}*#{size}
|
||||
</select>
|
||||
|
||||
@@ -100,10 +100,10 @@
|
||||
select
|
||||
count(*)
|
||||
from household h
|
||||
join admin_has_role ahr ON h.seq = ahr.admin_seq
|
||||
where ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
|
||||
join researcher_has_household rhh ON h.seq = rhh.household_seq and rhh.is_deleted = false
|
||||
where 1=1
|
||||
<if test="seq > 0">
|
||||
and ahr.admin_seq = #{seq}
|
||||
and rhh.admin_seq = #{seq}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@@ -155,4 +155,31 @@
|
||||
</foreach>)
|
||||
</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>
|
||||
@@ -15,8 +15,10 @@
|
||||
<section class="filter-wrap">
|
||||
<div class="form-area">
|
||||
<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="researcherName" id="researcherName" th:value="${researcherName}">
|
||||
<!-- 경영주 -->
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
@@ -141,8 +143,11 @@
|
||||
|
||||
<script th:inline="javascript">
|
||||
const showHouseholdModal = (button) => {
|
||||
// 버튼의 data-region-main-code 속성에서 regionMainCode 가져오기
|
||||
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");
|
||||
if (existingModal) {
|
||||
existingModal.remove();
|
||||
@@ -183,10 +188,10 @@
|
||||
$(response.content).each((idx, ct) => {
|
||||
tbody.append(
|
||||
`
|
||||
<tr data-id="${ct.id}">
|
||||
<tr data-id="${ct.householdSeq}">
|
||||
<td>
|
||||
<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>
|
||||
</td>
|
||||
<td>${ct.householdNum}</td>
|
||||
@@ -221,7 +226,7 @@
|
||||
const registerHouseholds = () => {
|
||||
const selectedIds = [];
|
||||
$('input[name="householdSelect"]:checked').each(function () {
|
||||
selectedIds.push($(this).val());
|
||||
selectedIds.push(Number($(this).val()));
|
||||
});
|
||||
|
||||
if (selectedIds.length === 0) {
|
||||
@@ -229,21 +234,31 @@
|
||||
return;
|
||||
}
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/researcher/mappingHousehold/search',
|
||||
{ regionMainCode: regionMainCode },
|
||||
function (response) {
|
||||
$("#mappingHouseholdModal").append(response);
|
||||
// 모달 표시
|
||||
if(confirm("총 "+selectedIds.length+"건에 대하여 조사원을 "+$('#researcherName').val()+"으로 설정하시겠습니까?")) {
|
||||
|
||||
},
|
||||
function (code, rstData) {
|
||||
alert('임가 등록에 실패했습니다.');
|
||||
},
|
||||
'get',
|
||||
'json',
|
||||
null
|
||||
);
|
||||
const data = {
|
||||
selectedIds: selectedIds,
|
||||
researcherSeq: $('#researcherSeq').val()
|
||||
};
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/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>
|
||||
</div>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
</p>
|
||||
|
||||
<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>
|
||||
</button>
|
||||
</div>
|
||||
@@ -236,7 +236,6 @@
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// 임가 방문 정보
|
||||
const getHouseholdVisitList = (pageNo) => {
|
||||
const f = document.householdReqForm;
|
||||
@@ -359,10 +358,6 @@
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</th:block>
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="text">Text *</label>
|
||||
<label class="col-sm-3 col-form-label" for="codeText">Text *</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="codeText" name="codeText" class="form-control"
|
||||
placeholder="코드명을 입력하세요"/>
|
||||
@@ -54,6 +54,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="codeType">코드 타입</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="codeType" name="codeType" class="form-control"
|
||||
placeholder="코드타입을 입력하세요"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="msgCode">메세지 코드</label>
|
||||
<div class="col-sm-9">
|
||||
@@ -62,6 +70,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="inUse">사용여부</label>
|
||||
<div class="col-sm-9">
|
||||
@@ -210,6 +219,7 @@
|
||||
f.id.value = data.id;
|
||||
f.codeText.value = data.codeText;
|
||||
f.codeValue.value = data.codeValue;
|
||||
f.codeType.value = data.codeType;
|
||||
f.msgCode.value = data.msgCode;
|
||||
f.orderNo.value = data.orderNo;
|
||||
f.parentId.value = data.parentId;
|
||||
@@ -309,6 +319,7 @@
|
||||
f.orderNo.value = '';
|
||||
f.codeText.value = '';
|
||||
f.codeValue.value = '';
|
||||
f.codeType.value = '';
|
||||
f.msgCode.value = '';
|
||||
f.inUse.value = 'true';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user