Compare commits
2 Commits
c58a916482
...
eea0329555
| Author | SHA1 | Date |
|---|---|---|
|
|
eea0329555 | |
|
|
98bed93ab1 |
|
|
@ -189,15 +189,6 @@ public class AffairController { // 첩보수집활동 > 외사경찰 견문관
|
|||
|
||||
@PostMapping("/affairStateChange")
|
||||
public Integer affairStateChange(@AuthenticationPrincipal UserInfo loginUser, AffairRating rating){
|
||||
String apprvType = "section";
|
||||
if(rating.getHeadApprv() == null){
|
||||
rating.setSectionNm(loginUser.getUserNm());
|
||||
rating.setSectionApprvDt(LocalDateTime.now());
|
||||
}else{
|
||||
apprvType = "head";
|
||||
rating.setHeadNm(loginUser.getUserNm());
|
||||
rating.setHeadApprvDt(LocalDateTime.now());
|
||||
}
|
||||
return affairService.affairStateChange(apprvType, rating);
|
||||
return affairService.affairStateChange(loginUser, rating);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -115,20 +116,36 @@ public class AffairService extends BaseService { // 견문보고
|
|||
}
|
||||
}
|
||||
|
||||
public Integer affairStateChange(String apprvType, AffairRating rating) {
|
||||
@Transactional
|
||||
public Integer affairStateChange(UserInfo loginUser, AffairRating rating) {
|
||||
AffairBoard savedAffair = affairBoardRepository.findById(rating.getAffairKey()).orElse(null);
|
||||
AffairRating savedRating = affairRatingRepository.findById(new AffairRating.AffairRatingId(rating.getAffairKey(), rating.getRatingOrgan())).orElse(null);
|
||||
if(savedRating != null){
|
||||
if(apprvType.equals("section")){
|
||||
savedRating.setSectionNm(rating.getSectionNm());
|
||||
savedRating.setSectionApprvDt(rating.getSectionApprvDt());
|
||||
if(savedAffair!= null && savedRating != null){
|
||||
if(rating.getHeadApprv() == null){
|
||||
savedAffair.setAffairStatus(rating.getSectionApprv());
|
||||
savedRating.setSectionNm(loginUser.getUserNm());
|
||||
savedRating.setSectionApprvDt(LocalDateTime.now());
|
||||
savedRating.setSectionApprv(rating.getSectionApprv());
|
||||
savedRating.setSectionEtc(rating.getSectionEtc());
|
||||
}else{
|
||||
savedRating.setHeadNm(rating.getHeadNm());
|
||||
savedRating.setHeadApprvDt(rating.getHeadApprvDt());
|
||||
savedAffair.setAffairStatus(rating.getHeadApprv());
|
||||
savedRating.setHeadNm(loginUser.getUserNm());
|
||||
savedRating.setHeadApprvDt(LocalDateTime.now());
|
||||
savedRating.setHeadApprv(rating.getHeadApprv());
|
||||
savedRating.setHeadEtc(rating.getHeadEtc());
|
||||
savedRating.setAffairRate(rating.getAffairRate());
|
||||
savedRating.setOrganUp(rating.getOrganUp());
|
||||
if(rating.getOrganUp().equals("T")){
|
||||
List<String> organList = loginUser.getUpOrganCdList();
|
||||
String upOrgan = organList.get(organList.indexOf(savedRating.getRatingOrgan())-1);
|
||||
AffairRating upRating = new AffairRating();
|
||||
upRating.setRatingOrgan(upOrgan);
|
||||
upRating.setAffairKey(savedRating.getAffairKey());
|
||||
affairRatingRepository.save(upRating);
|
||||
savedAffair.setAffairStatus("DST002");
|
||||
}
|
||||
}
|
||||
affairBoardRepository.save(savedAffair);
|
||||
affairRatingRepository.save(savedRating);
|
||||
}
|
||||
return rating.getAffairKey();
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@
|
|||
a.wrt_dt,
|
||||
b.fileCnt
|
||||
from affair_board a
|
||||
left outer join (select affair_key,
|
||||
left outer join (select affair_key,
|
||||
count(file_seq) as fileCnt
|
||||
from affair_file
|
||||
group by affair_key) b
|
||||
on a.affair_key = b.affair_key
|
||||
on a.affair_key = b.affair_key
|
||||
<include refid="selectAffairBoardWhere"></include>
|
||||
order by affair_key desc
|
||||
limit #{rowCnt} offset #{firstIndex}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,44 @@ $(document).on('click', '#saveAffairBtn', function (){
|
|||
$(document).on('click', '#saveTempBtn', function (){
|
||||
saveAffair('DST001')
|
||||
})
|
||||
$(document).on('click', '.apprvBtn', function (){
|
||||
const apprvType = $(this).attr("data-apprvtype");
|
||||
let flag = true;
|
||||
if(apprvType==="head"){
|
||||
if(!$("#affairRate").val()){
|
||||
alert("견문평가를 선택해주세요.")
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
if(confirm($(this).val()+"하시겠습니까?")){
|
||||
$((apprvType === "section"?"#sectionApprv":"#headApprv")).val($(this).attr("data-affairstate"))
|
||||
const ratingOrganCd = $(".ratingOrganCd")
|
||||
$("#apprvFormRatingOrgan").val(ratingOrganCd[ratingOrganCd.length-1].value);
|
||||
const formData = new FormData($("#apprvForm")[0]);
|
||||
contentFade("in")
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
data : formData,
|
||||
url : "/affair/affairStateChange",
|
||||
processData: false,
|
||||
contentType: false,
|
||||
beforeSend: function (xhr){
|
||||
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
||||
},
|
||||
success : function(result) {
|
||||
alert("저장되었습니다")
|
||||
getAffairViewModal(result);
|
||||
contentFade("out");
|
||||
},
|
||||
error : function(xhr, status) {
|
||||
alert("저장에 실패하였습니다.");
|
||||
contentFade("out");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function getAffairViewModal(affairKey){
|
||||
$.ajax({
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ $(document).on('click', '.apprvBtn', function (){
|
|||
},
|
||||
success : function(result) {
|
||||
alert("저장되었습니다")
|
||||
getPlanViewModal(result);
|
||||
contentFade("out");
|
||||
},
|
||||
error : function(xhr, status) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
<div class="col-sm-2">
|
||||
<th:block th:each="code:${session.commonCode.get('AVS')}">
|
||||
<th:block th:if="${code.itemCd eq affair.viewStatus}">
|
||||
<input type="text" class="form-control form-control-sm border-0" id="viewStatus" th:value="${code.itemValue}">
|
||||
<input type="text" class="form-control form-control-sm border-0" id="viewStatus" th:value="${code.itemValue}" readonly>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</div>
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
<div class="col-sm-2">
|
||||
<th:block th:each="code:${session.commonCode.get('DC01')}">
|
||||
<th:block th:if="${code.itemCd eq affair.affairType1}">
|
||||
<input type="text" class="form-control form-control-sm border-0" id="affairType1" th:value="${code.itemValue}">
|
||||
<input type="text" class="form-control form-control-sm border-0" id="affairType1" th:value="${code.itemValue}" readonly>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</div>
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
<div class="col-sm-2">
|
||||
<th:block th:each="code:${session.commonCode.get('DC02')}">
|
||||
<th:block th:if="${code.itemCd eq affair.affairType2}">
|
||||
<input type="text" class="form-control form-control-sm border-0" id="affairType2" th:value="${code.itemValue}">
|
||||
<input type="text" class="form-control form-control-sm border-0" id="affairType2" th:value="${code.itemValue}" readonly>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</div>
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
<div class="col-sm-2">
|
||||
<th:block th:each="code:${session.commonCode.get('DC03')}">
|
||||
<th:block th:if="${code.itemCd eq affair.affairType3}">
|
||||
<input type="text" class="form-control form-control-sm border-0" id="affairType3" th:value="${code.itemValue}">
|
||||
<input type="text" class="form-control form-control-sm border-0" id="affairType3" th:value="${code.itemValue}" readonly>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</div>
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
<div class="col-sm-2">
|
||||
<th:block th:each="code:${session.commonCode.get('DC04')}">
|
||||
<th:block th:if="${code.itemCd eq affair.affairType4}">
|
||||
<input type="text" class="form-control form-control-sm border-0" id="affairType4" th:value="${code.itemValue}">
|
||||
<input type="text" class="form-control form-control-sm border-0" id="affairType4" th:value="${code.itemValue}" readonly>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</div>
|
||||
|
|
@ -170,7 +170,7 @@
|
|||
<div class="row" th:if="${rate.headApprv ne null}">
|
||||
<div class="col-auto">
|
||||
<th:block th:each="commonCode:${session.commonCode.get('AAR')}">
|
||||
<span th:if="${commonCode.itemCd eq rate.affairRate}" th:text="|견문평가: ${commonCode.itemValue} ${rate.organ_up eq 'T'?'(상보)':''}|"></span>
|
||||
<span th:if="${commonCode.itemCd eq rate.affairRate}" th:text="|견문평가: ${commonCode.itemValue} ${rate.organUp eq 'T'?'(상보)':''}|"></span>
|
||||
</th:block>
|
||||
<span th:text="|결재자: ${rate.headNm}|"></span>
|
||||
</div>
|
||||
|
|
@ -188,20 +188,50 @@
|
|||
</div>
|
||||
<div class="col-12" th:if="${apprvAuth ne null}">
|
||||
<form action="#" method="post" id="apprvForm">
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<input type="hidden" name="affairKey" id="apprvFormAffairKey">
|
||||
<input type="hidden" name="state" id="viewModalApprvValue">
|
||||
<input type="text" class="form-control form-control-sm" name="etc" placeholder="추가의견, 반려사유 기입">
|
||||
<input type="text" class="d-none" id="submitPrevention">
|
||||
<input type="hidden" name="affairKey" th:value="${affair.affairKey}">
|
||||
<input type="hidden" name="ratingOrgan" id="apprvFormRatingOrgan">
|
||||
<th:block th:if="${(apprvAuth eq 'APC003' or apprvAuth eq 'APC004') and affair.affairStatus eq 'DST002'}">
|
||||
<input type="hidden" name="sectionApprv" id="sectionApprv">
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<input type="text" class="form-control form-control-sm" name="sectionEtc" placeholder="추가의견, 반려사유 기입">
|
||||
<input type="text" class="d-none" id="submitPrevention">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<input type="button" class="btn btn-sm btn-success apprvBtn" data-apprvtype="section" data-affairstate="DST004" value="승인">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<input type="button" class="btn btn-sm btn-danger apprvBtn" data-apprvtype="section" data-affairstate="DST003" value="반려">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<input type="button" class="btn btn-sm btn-success apprvBtn" th:data-affairstate="${apprvAuth eq 'APC004'||apprvAuth eq 'APC003'?'DST004':'DST006'}" value="승인">
|
||||
</th:block>
|
||||
<th:block th:if="${(apprvAuth eq 'APC001' or apprvAuth eq 'APC002') and affair.affairStatus eq 'DST004'}">
|
||||
<input type="hidden" name="headApprv" id="headApprv">
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<input type="text" class="form-control form-control-sm" name="headEtc" placeholder="추가의견, 반려사유 기입">
|
||||
<input type="text" class="d-none" id="submitPrevention">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<select class="form-select form-select-sm" name="affairRate" id="affairRate">
|
||||
<option value="">견문평가</option>
|
||||
<th:block th:each="commonCode:${session.commonCode.get('AAR')}">
|
||||
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
|
||||
</th:block>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<label for="organUp" class="form-check-label">상보여부</label>
|
||||
<input type="checkbox" id="organUp" name="organUp" value="T">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<input type="button" class="btn btn-sm btn-success apprvBtn" data-apprvtype="head" data-affairstate="DST006" value="승인">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<input type="button" class="btn btn-sm btn-danger apprvBtn" data-apprvtype="head" data-affairstate="DST005" value="반려">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<input type="button" class="btn btn-sm btn-danger apprvBtn" th:data-affairstate="${apprvAuth eq 'APC004'||apprvAuth eq 'APC003'?'DST003':'DST005'}" value="반려">
|
||||
</div>
|
||||
</div>
|
||||
</th:block>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue