외사방첩관리 > 외사활동 > 담당사건목록 삭제기능 추가.

master
강석 최 2023-05-08 14:41:43 +09:00
parent e46bdafa64
commit 9455c8e8cb
7 changed files with 54 additions and 32 deletions

View File

@ -86,6 +86,7 @@ public class ActivityCaseController {
ModelAndView mav = new ModelAndView("counterIntelligence/activityCase/activityCaseSummaryModal"); ModelAndView mav = new ModelAndView("counterIntelligence/activityCase/activityCaseSummaryModal");
mav.addObject("modalType", activityCase.getModalType()); mav.addObject("modalType", activityCase.getModalType());
List<ActivityCaseSummary> activityCaseList = activityCaseService.selectActivityCaseInfoList(activityCase.getReceiptKey()); List<ActivityCaseSummary> activityCaseList = activityCaseService.selectActivityCaseInfoList(activityCase.getReceiptKey());
mav.addObject("viewUserSeq", loginUser.getUserSeq()); mav.addObject("viewUserSeq", loginUser.getUserSeq());
mav.addObject("wrtUserSeq", activityCaseList.get(activityCaseList.size()-1).getWrtUserSeq()); mav.addObject("wrtUserSeq", activityCaseList.get(activityCaseList.size()-1).getWrtUserSeq());
mav.addObject("lastCaseType", activityCaseList.get(activityCaseList.size()-1).getCaseType()); mav.addObject("lastCaseType", activityCaseList.get(activityCaseList.size()-1).getCaseType());
@ -125,14 +126,15 @@ public class ActivityCaseController {
} }
@PostMapping("/deleteActivityCase") @PostMapping("/deleteActivityCase")
public Integer deleteActivityCase(@AuthenticationPrincipal UserInfo loginUser, ActivityCase activityCase){ @ResponseBody
String accessAuth = authMgtService.selectAccessConfigList public void deleteActivityCase(@AuthenticationPrincipal UserInfo loginUser, @RequestBody ActivityCase activityCase){
(loginUser.getUserSeq(), "/counterIntelligence/activityCaseList").get(0).getAccessAuth(); activityCaseService.deleteActivityCase(activityCase.getReceiptKey());
if(accessAuth.equals("ACC003")){ }
return activityCaseService.deleteActivityCase(activityCase.getReceiptKey());
}else{ @PostMapping("/deleteActivityCaseInfo")
return 0; @ResponseBody
} public void deleteActivityCaseInfo(@AuthenticationPrincipal UserInfo loginUser, @RequestBody ActivityCaseInfo acInfo) {
activityCaseService.deleteActivityCaseInfo(acInfo.getCaseKey());
} }
@GetMapping("/activityCaseMgt") @GetMapping("/activityCaseMgt")

View File

@ -2,8 +2,16 @@ package com.dbnt.faisp.main.counterIntelligence.activityCase.repository;
import com.dbnt.faisp.main.counterIntelligence.activityCase.model.ActivityCaseInfo; import com.dbnt.faisp.main.counterIntelligence.activityCase.model.ActivityCaseInfo;
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;
public interface ActivityCaseInfoRepository extends JpaRepository<ActivityCaseInfo, Integer> { public interface ActivityCaseInfoRepository extends JpaRepository<ActivityCaseInfo, Integer> {
@Modifying(clearAutomatically = true)
@Query("update ActivityCaseInfo set status = :status where receiptKey = :receiptKey")
void bulkModifyingByReceiptKeyToStatus(Integer receiptKey, String status);
@Modifying(clearAutomatically = true)
@Query("update ActivityCaseInfo set status = :status where caseKey = :caseKey")
void bulkModifyingByCaseKeyToStatus(Integer caseKey, String status);
} }

View File

@ -124,16 +124,12 @@ public class ActivityCaseService extends BaseService {
} }
@Transactional @Transactional
public Integer deleteActivityCase(Integer receiptKey) { public void deleteActivityCase(Integer receiptKey) {
ActivityCase activityCase = acRepository.findById(receiptKey).orElse(null); aciRepository.bulkModifyingByReceiptKeyToStatus(receiptKey, "DST008");
return receiptKey;
} }
@Transactional @Transactional
public Integer deleteActivityCaseInfo(Integer caseKey) { public void deleteActivityCaseInfo(Integer caseKey) {
ActivityCaseInfo activityCaseInfo = aciRepository.findById(caseKey).orElse(null); aciRepository.bulkModifyingByCaseKeyToStatus(caseKey, "DST008");
return caseKey;
} }
private String makeReceiptNum(int year){ private String makeReceiptNum(int year){

View File

@ -6,6 +6,7 @@
<mapper namespace="com.dbnt.faisp.main.counterIntelligence.activityCase.mapper.ActivityCaseMapper"> <mapper namespace="com.dbnt.faisp.main.counterIntelligence.activityCase.mapper.ActivityCaseMapper">
<sql id="selectActivityCaseListWhere"> <sql id="selectActivityCaseListWhere">
<where> <where>
c.status &lt;> 'DST008'
<if test='receiptKey != null and receiptKey != ""'> <if test='receiptKey != null and receiptKey != ""'>
and a.receipt_key = #{receiptKey} and a.receipt_key = #{receiptKey}
</if> </if>
@ -172,6 +173,7 @@
group by case_key group by case_key
) d on b.case_key = d.case_key ) d on b.case_key = d.case_key
where a.receipt_key = #{receiptKey} where a.receipt_key = #{receiptKey}
and b.status &lt;> 'DST008'
order by b.wrt_dt asc order by b.wrt_dt asc
</select> </select>

View File

@ -75,6 +75,13 @@ $(document).on('click', '#editInfoBtn', function (){
getActivityCaseEditModal(modalBody.find('#receiptKey').val(), modalBody.find('#caseKey').val(), modalBody.find('#caseType').val()) getActivityCaseEditModal(modalBody.find('#receiptKey').val(), modalBody.find('#caseKey').val(), modalBody.find('#caseType').val())
}) })
$(document).on('click', '#deleteAllBtn', function (){
deleteActivityCase("/counterIntelligence/deleteActivityCase", "receiptKey", $(this).attr('data-receiptkey'));
})
$(document).on('click', '#deleteInfoBtn', function (){
deleteActivityCase("/counterIntelligence/deleteActivityCaseInfo", "caseKey", $("#caseKey").val());
})
$(document).on('click', '.apprvBtn', function (){ $(document).on('click', '.apprvBtn', function (){
const apprvValue = $(this).attr('data-apprvvalue'); const apprvValue = $(this).attr('data-apprvvalue');
if (confirm((apprvValue==="Y"?"승인":"반려")+"하시겠습니까?")){ if (confirm((apprvValue==="Y"?"승인":"반려")+"하시겠습니까?")){
@ -257,23 +264,21 @@ function setApprvResult(caseKey, userSeq, instructions, apprvValue){
}) })
} }
function deleteActivityCase(caseKey){ function deleteActivityCase(url, keyName, keyValue){
if(confirm("삭제하시겠습니까?")){ if(confirm("삭제하시겠습니까?\n되돌릴 수 없습니다.")){
contentFade("in"); contentFade("in");
const formData = new FormData(); const param = {};
formData.append('caseKey', caseKey); param[keyName] = keyValue;
$.ajax({ $.ajax({
type : 'POST', type : 'POST',
data : formData, data : JSON.stringify(param),
url : "/counterIntelligence/deleteActivityCase", url : url,
processData: false, contentType: 'application/json',
contentType: false,
beforeSend: function (xhr){ beforeSend: function (xhr){
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val()); xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
}, },
success : function(result) { success : function(result) {
alert("삭제되었습니다."); alert("삭제되었습니다.");
contentFade("out");
location.reload(); location.reload();
}, },
error : function(xhr, status) { error : function(xhr, status) {

View File

@ -45,8 +45,13 @@
</table> </table>
</div> </div>
<th:block th:if="${modalType ne 'viewOnly'}"> <th:block th:if="${modalType ne 'viewOnly'}">
<div class="modal-footer bg-light" th:if="${lastCaseType ne 'ACT003' and viewUserSeq eq wrtUserSeq}"> <div class="modal-footer bg-light">
<button type="button" class="btn btn-outline-dark addInfoBtn" th:data-receiptkey="${receiptKey}" data-casetype="ACT002" th:data-laststatus="${lastStatus}">진행보고서 작성</button> <th:block>
<button type="button" class="btn btn-outline-dark addInfoBtn" th:data-receiptkey="${receiptKey}" data-casetype="ACT003" th:data-laststatus="${lastStatus}">결과보고서 작성</button> <button type="button" class="btn btn-outline-dark" id="deleteAllBtn" th:data-receiptkey="${receiptKey}">전체 삭제</button>
</th:block>
<th:block th:if="${lastCaseType ne 'ACT003' and viewUserSeq eq wrtUserSeq}">
<button type="button" class="btn btn-outline-dark addInfoBtn" th:data-receiptkey="${receiptKey}" data-casetype="ACT002" th:data-laststatus="${lastStatus}">진행보고서 작성</button>
<button type="button" class="btn btn-outline-dark addInfoBtn" th:data-receiptkey="${receiptKey}" data-casetype="ACT003" th:data-laststatus="${lastStatus}">결과보고서 작성</button>
</th:block>
</div> </div>
</th:block> </th:block>

View File

@ -192,8 +192,12 @@
</div> </div>
</div> </div>
<th:block th:if="${modalType ne 'viewOnly'}"> <th:block th:if="${modalType ne 'viewOnly'}">
<div class="modal-footer bg-light" th:if="${activityCaseInfo.status eq 'DST001' and viewUserSeq eq activityCase.wrtUserSeq}"> <div class="modal-footer bg-light">
<!--<button type="button" class="btn btn-danger" id="deleteInfoBtn">삭제</button>--> <th:block th:if="${viewUserSeq eq activityCase.wrtUserSeq}">
<button type="button" class="btn btn-warning" id="editInfoBtn">수정</button> <button type="button" class="btn btn-danger" id="deleteInfoBtn">삭제</button>
</div> </th:block>
<th:block th:if="${activityCaseInfo.status eq 'DST001' and viewUserSeq eq activityCase.wrtUserSeq}">
<button type="button" class="btn btn-warning" id="editInfoBtn">수정</button>
</th:block>
</div>
</th:block> </th:block>