수신알람목록 읽음처리 기능 추가.
parent
14e29ff517
commit
34ba764694
|
|
@ -85,13 +85,24 @@ public class MyInfoController {
|
||||||
ModelAndView mav = new ModelAndView("user/myAlarm");
|
ModelAndView mav = new ModelAndView("user/myAlarm");
|
||||||
alarm.setQueryInfo();
|
alarm.setQueryInfo();
|
||||||
alarm.setUserSeq(loginUser.getUserSeq());
|
alarm.setUserSeq(loginUser.getUserSeq());
|
||||||
mav.addObject("cat1List", codeMgtService.selectCodeMgtList("CAT1"));
|
mav.addObject("userSeq", loginUser.getUserSeq());
|
||||||
mav.addObject("cat2List", codeMgtService.selectCodeMgtList("CAT2"));
|
|
||||||
mav.addObject("cat3List", codeMgtService.selectCodeMgtList("CAT3"));
|
|
||||||
mav.addObject("pageAlarmList", userAlarmService.selectAlarmList(alarm));
|
mav.addObject("pageAlarmList", userAlarmService.selectAlarmList(alarm));
|
||||||
alarm.setContentCnt(userAlarmService.selectAlarmListCnt(alarm));
|
alarm.setContentCnt(userAlarmService.selectAlarmListCnt(alarm));
|
||||||
alarm.setPaginationInfo();
|
alarm.setPaginationInfo();
|
||||||
mav.addObject("searchParams", alarm);
|
mav.addObject("searchParams", alarm);
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/alarmStateChange")
|
||||||
|
@ResponseBody
|
||||||
|
public void alarmStateChange(@RequestBody List<UserAlarm> alarmList){
|
||||||
|
userAlarmService.alarmStateChange(alarmList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@PostMapping("/alarmStateChangeAll")
|
||||||
|
@ResponseBody
|
||||||
|
public void alarmStateChangeAll(@RequestBody Integer userSeq){
|
||||||
|
|
||||||
|
System.out.println(userSeq);
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,14 @@ package com.dbnt.faisp.main.userInfo.repository;
|
||||||
|
|
||||||
import com.dbnt.faisp.main.userInfo.model.UserAlarm;
|
import com.dbnt.faisp.main.userInfo.model.UserAlarm;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface UserAlarmRepository extends JpaRepository<UserAlarm, UserAlarm.UserAlarmId> {
|
public interface UserAlarmRepository extends JpaRepository<UserAlarm, UserAlarm.UserAlarmId> {
|
||||||
|
|
||||||
|
@Modifying(clearAutomatically = true)
|
||||||
|
@Query("update UserAlarm set viewYn = 'Y' where userSeq = :userSeq and alarmKey in (:alarmKeyList)")
|
||||||
|
void bulkModifyingByUserAlarmToUserSeqAndAlarmKeyList(Integer userSeq, List<String> alarmKeyList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,4 +75,14 @@ public class UserAlarmService {
|
||||||
public void updateAlarm(UserAlarm alarm) {
|
public void updateAlarm(UserAlarm alarm) {
|
||||||
userAlarmRepository.save(alarm);
|
userAlarmRepository.save(alarm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void alarmStateChange(List<UserAlarm> alarmList) {
|
||||||
|
Integer userSeq = alarmList.get(0).getUserSeq();
|
||||||
|
List<String> alarmKeyList = new ArrayList<>();
|
||||||
|
for(UserAlarm alarm: alarmList){
|
||||||
|
alarmKeyList.add(alarm.getAlarmKey());
|
||||||
|
}
|
||||||
|
userAlarmRepository.bulkModifyingByUserAlarmToUserSeqAndAlarmKeyList(userSeq, alarmKeyList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,13 @@ $(document).on('click', '#bellIcon', function (){
|
||||||
alarmListDiv.className = "position-absolute bg-white card d-none";
|
alarmListDiv.className = "position-absolute bg-white card d-none";
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$(document).on('click', '.alarmTr', function (){
|
$(document).on('click', '.alarmTr', function (event){
|
||||||
|
const target = event.target;
|
||||||
|
if(!(target.className === "checkBoxTd" || target.parentElement.className === "checkBoxTd")){
|
||||||
location.href = "/myInfo/moveAlarmBoard?" +
|
location.href = "/myInfo/moveAlarmBoard?" +
|
||||||
"alarmKey="+$(this).find(".alarmKey").val()+
|
"alarmKey="+$(this).find(".alarmKey").val()+
|
||||||
"&userSeq="+$(this).find(".userSeq").val();
|
"&userSeq="+$(this).find(".userSeq").val();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
$(document).on('change', '#ogCdSearch', function (){
|
$(document).on('change', '#ogCdSearch', function (){
|
||||||
const ofcCdSearch = $("#ofcCdSearch")
|
const ofcCdSearch = $("#ofcCdSearch")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
$(function (){
|
||||||
|
$("#dateSelectorDiv").datepicker({
|
||||||
|
format: "yyyy-mm-dd",
|
||||||
|
language: "ko",
|
||||||
|
autoclose: true
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
$(document).on('click', '#stateChangeBtn', function (){
|
||||||
|
const checkedAlarmList = $(".alarmCheckBox:checked");
|
||||||
|
if(checkedAlarmList.length === 0) {
|
||||||
|
alert("대상을 선택해주세요.")
|
||||||
|
}else{
|
||||||
|
if(confirm("선택 목록을 읽음처리 하시겠습니까?")){
|
||||||
|
const userSeq = $(this).attr('data-userseq');
|
||||||
|
const alarmList = [];
|
||||||
|
$.each(checkedAlarmList, function (idx, checkBox){
|
||||||
|
alarmList.push({
|
||||||
|
alarmKey: $(checkBox).parents('.alarmTr').find('.alarmKey').val(),
|
||||||
|
userSeq: userSeq
|
||||||
|
})
|
||||||
|
})
|
||||||
|
$.ajax({
|
||||||
|
type : 'POST',
|
||||||
|
url : "/myInfo/alarmStateChange",
|
||||||
|
data : JSON.stringify(alarmList),
|
||||||
|
contentType: 'application/json',
|
||||||
|
beforeSend: function (xhr){
|
||||||
|
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
||||||
|
},
|
||||||
|
success : function(data) {
|
||||||
|
alert('변경되었습니다.')
|
||||||
|
location.reload();
|
||||||
|
},
|
||||||
|
error : function(xhr, status) {
|
||||||
|
alert("상태 변경에 실패하였습니다");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
/*$(document).on('click', '#stateChangeAllBtn', function (){
|
||||||
|
$.ajax({
|
||||||
|
type : 'POST',
|
||||||
|
url : "/myInfo/alarmStateChangeAll",
|
||||||
|
data : JSON.stringify({userSeq: Number($(this).attr('data-userseq'))}),
|
||||||
|
contentType: 'application/json',
|
||||||
|
beforeSend: function (xhr){
|
||||||
|
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
||||||
|
},
|
||||||
|
success : function(data) {
|
||||||
|
location.reload();
|
||||||
|
},
|
||||||
|
error : function(xhr, status) {
|
||||||
|
alert("상태 변경에 실패하였습니다");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})*/
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body" id="icaEditBody">
|
<div class="modal-body" id="icaEditBody">
|
||||||
<form action="#" method="post" id="icaEditForm">
|
<form action="#" method="post" id="icaEditForm">
|
||||||
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
|
|
||||||
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
|
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
|
||||||
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
|
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
|
||||||
<input type="hidden" name="icaKey" th:value="${internationalCrimeArrest.icaKey}">
|
<input type="hidden" name="icaKey" th:value="${internationalCrimeArrest.icaKey}">
|
||||||
|
|
|
||||||
|
|
@ -3,21 +3,15 @@
|
||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
layout:decorate="~{layout/layout}">
|
layout:decorate="~{layout/layout}">
|
||||||
<th:block layout:fragment="script">
|
<th:block layout:fragment="script">
|
||||||
<script type='text/javascript'>
|
<script type="text/javascript" th:src="@{/js/user/myAlarm.js}"></script>
|
||||||
$(function (){
|
|
||||||
$("#dateSelectorDiv").datepicker({
|
|
||||||
format: "yyyy-mm-dd",
|
|
||||||
language: "ko",
|
|
||||||
autoclose: true
|
|
||||||
});
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</th:block>
|
</th:block>
|
||||||
<div layout:fragment="content">
|
<div layout:fragment="content">
|
||||||
<main>
|
<main>
|
||||||
<h4>수신 알람 목록</h4>
|
<h4>수신 알람 목록</h4>
|
||||||
<div class="row mx-0">
|
<div class="row mx-0">
|
||||||
<div class="col-12 card bg-light">
|
<div class="col-12 card bg-light">
|
||||||
|
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
|
||||||
|
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form method="get" th:action="@{/myInfo/myAlarm}">
|
<form method="get" th:action="@{/myInfo/myAlarm}">
|
||||||
<input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
|
<input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
|
||||||
|
|
@ -44,20 +38,20 @@
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<select class="form-select form-select-sm" name="cat1Cd">
|
<select class="form-select form-select-sm" name="cat1Cd">
|
||||||
<option value="">대분류</option>
|
<option value="">대분류</option>
|
||||||
<th:block th:each="code:${cat1List}">
|
<th:block th:each="code:${session.commonCode.get('CAT1')}">
|
||||||
<option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq searchParams.cat1Cd}"></option>
|
<option th:if="${code.useChk eq 'T'}" th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq searchParams.cat1Cd}"></option>
|
||||||
</th:block>
|
</th:block>
|
||||||
</select>
|
</select>
|
||||||
<select class="form-select form-select-sm" name="cat2Cd">
|
<select class="form-select form-select-sm" name="cat2Cd">
|
||||||
<option value="">중분류</option>
|
<option value="">중분류</option>
|
||||||
<th:block th:each="code:${cat2List}">
|
<th:block th:each="code:${session.commonCode.get('CAT2')}">
|
||||||
<option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq searchParams.cat2Cd}"></option>
|
<option th:if="${code.useChk eq 'T'}" th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq searchParams.cat2Cd}"></option>
|
||||||
</th:block>
|
</th:block>
|
||||||
</select>
|
</select>
|
||||||
<select class="form-select form-select-sm" name="cat3Cd">
|
<select class="form-select form-select-sm" name="cat3Cd">
|
||||||
<option value="">소분류</option>
|
<option value="">소분류</option>
|
||||||
<th:block th:each="code:${cat3List}">
|
<th:block th:each="code:${session.commonCode.get('CAT3')}">
|
||||||
<option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq searchParams.cat3Cd}"></option>
|
<option th:if="${code.useChk eq 'T'}" th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq searchParams.cat3Cd}"></option>
|
||||||
</th:block>
|
</th:block>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -91,6 +85,7 @@
|
||||||
<table class="table table-sm table-hover table-bordered">
|
<table class="table table-sm table-hover table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="table-secondary">
|
<tr class="table-secondary">
|
||||||
|
<th><input type="checkbox" class="allChk"> </th>
|
||||||
<th>대분류</th>
|
<th>대분류</th>
|
||||||
<th>중분류</th>
|
<th>중분류</th>
|
||||||
<th>소분류</th>
|
<th>소분류</th>
|
||||||
|
|
@ -103,6 +98,7 @@
|
||||||
<tr class="alarmTr" th:each="alarm:${pageAlarmList}">
|
<tr class="alarmTr" th:each="alarm:${pageAlarmList}">
|
||||||
<input type="hidden" class="alarmKey" th:value="${alarm.alarmKey}">
|
<input type="hidden" class="alarmKey" th:value="${alarm.alarmKey}">
|
||||||
<input type="hidden" class="userSeq" th:value="${alarm.userSeq}">
|
<input type="hidden" class="userSeq" th:value="${alarm.userSeq}">
|
||||||
|
<td class="checkBoxTd"><input type="checkbox" class="alarmCheckBox"> </td>
|
||||||
<td>
|
<td>
|
||||||
<th:block th:each="code:${session.commonCode.get('CAT1')}">
|
<th:block th:each="code:${session.commonCode.get('CAT1')}">
|
||||||
<th:block th:if="${code.itemCd eq alarm.cat1Cd}" th:text="${code.itemValue}"></th:block>
|
<th:block th:if="${code.itemCd eq alarm.cat1Cd}" th:text="${code.itemValue}"></th:block>
|
||||||
|
|
@ -126,7 +122,11 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-between">
|
||||||
|
<div class="col-auto">
|
||||||
|
<input type="button" class="btn btn-sm btn-info" id="stateChangeBtn" value="선택 목록 읽음 처리" th:data-userseq="${userSeq}">
|
||||||
|
<!--<input type="button" class="btn btn-sm btn-warning" id="stateChangeAllBtn" value="전체 읽음 처리" th:data-userseq="${userSeq}">-->
|
||||||
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<nav aria-label="Page navigation">
|
<nav aria-label="Page navigation">
|
||||||
<ul class="pagination mb-0">
|
<ul class="pagination mb-0">
|
||||||
|
|
@ -152,6 +152,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-auto"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue