parent
9ac57dd743
commit
633efb21ea
|
|
@ -13,6 +13,7 @@ import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
|
|
@ -30,8 +31,10 @@ public class PoliceService {
|
|||
public void saveCareer(UserCareer career) {
|
||||
UserCareer lastCareer = userCareerRepository.findTop1ByUserSeqOrderByCareerSeqDesc(career.getUserSeq()).orElse(null);
|
||||
career.setCareerSeq(lastCareer==null?1:(lastCareer.getCareerSeq()+1));
|
||||
career.setWorkMonth((int) ChronoUnit.MONTHS.between(career.getStartDate(), career.getEndDate()));
|
||||
career.setWorkDay((int) ChronoUnit.DAYS.between(career.getStartDate(), career.getEndDate()));
|
||||
if(!career.getInOfficeYn().equals("Y")){
|
||||
career.setWorkMonth((int) ChronoUnit.MONTHS.between(career.getStartDate(), career.getEndDate()));
|
||||
career.setWorkDay((int) ChronoUnit.DAYS.between(career.getStartDate(), career.getEndDate()));
|
||||
}
|
||||
userCareerRepository.save(career);
|
||||
}
|
||||
|
||||
|
|
@ -45,7 +48,15 @@ public class PoliceService {
|
|||
}
|
||||
|
||||
public List<UserCareer> selectCareerList(Integer userSeq) {
|
||||
return userCareerRepository.findByUserSeqOrderByStartDateDesc(userSeq);
|
||||
List<UserCareer> careerList = userCareerRepository.findByUserSeqOrderByStartDateDesc(userSeq);
|
||||
for(UserCareer career: careerList){
|
||||
if(career.getEndDate()==null){
|
||||
career.setEndDate(LocalDate.now());
|
||||
career.setWorkMonth((int) ChronoUnit.MONTHS.between(career.getStartDate(), career.getEndDate()));
|
||||
career.setWorkDay((int) ChronoUnit.DAYS.between(career.getStartDate(), career.getEndDate()));
|
||||
}
|
||||
}
|
||||
return careerList;
|
||||
}
|
||||
|
||||
public void deleteCareer(UserCareer career) {
|
||||
|
|
|
|||
|
|
@ -144,7 +144,13 @@
|
|||
sum(case when career_cd = 'CRC005' then work_month else 0 end) as crc005Sum,
|
||||
sum(case when career_cd = 'CRC006' then work_month else 0 end) as crc006Sum,
|
||||
max(wrt_dt) as lastCareerWrtDt
|
||||
from user_career
|
||||
from (
|
||||
select user_seq,
|
||||
career_seq,
|
||||
career_cd,
|
||||
coalesce(work_month, (EXTRACT(YEAR FROM AGE(now()::date, start_date)) * 12 + EXTRACT(MONTH FROM AGE(now()::date, start_date)))) as work_month,
|
||||
wrt_dt
|
||||
from user_career ) aa
|
||||
group by user_seq
|
||||
) b on a.user_seq = b.user_seq
|
||||
<include refid="selectPoliceListWhere"></include>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ $(document).on('click', '#fieldTab', function (){
|
|||
})
|
||||
|
||||
function goFieldStatistics(){
|
||||
searchFade("in");
|
||||
|
||||
const formData = new FormData($("#searchFm")[0]);
|
||||
$.ajax({
|
||||
url: '/affair/fieldStatistics',
|
||||
|
|
@ -36,10 +36,10 @@ function goFieldStatistics(){
|
|||
$("#statisticsBody").empty().append(html)
|
||||
$("#statisticsBody").show();
|
||||
$(".statisticsMenu").hide();
|
||||
searchFade("out");
|
||||
|
||||
},
|
||||
error:function(e){
|
||||
searchFade("out");
|
||||
|
||||
ajaxErrorAction(e);
|
||||
}
|
||||
});
|
||||
|
|
@ -61,7 +61,7 @@ $(document).on('click', '#ratingTab', function (){
|
|||
})
|
||||
|
||||
function goRatingStatistics(){
|
||||
searchFade("in");
|
||||
|
||||
const formData = new FormData($("#searchFm")[0]);
|
||||
$.ajax({
|
||||
url: '/affair/ratingStatistics',
|
||||
|
|
@ -74,10 +74,10 @@ function goRatingStatistics(){
|
|||
$("#statisticsBody").empty().append(html)
|
||||
$("#statisticsBody").show();
|
||||
$(".statisticsMenu").hide();
|
||||
searchFade("out");
|
||||
|
||||
},
|
||||
error:function(e){
|
||||
searchFade("out");
|
||||
|
||||
ajaxErrorAction(e);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -208,28 +208,18 @@ function checkValue(){
|
|||
}
|
||||
|
||||
$(document).on('change', '#inOfficeYn', function (){
|
||||
const today = new Date();
|
||||
const year = today.getFullYear();
|
||||
const month = ('0' + (today.getMonth() + 1)).slice(-2);
|
||||
const day = ('0' + today.getDate()).slice(-2);
|
||||
const dateString = year + '-' + month + '-' + day;
|
||||
if($("#startDate").val() == ""){
|
||||
alert("근무시작일을 입력해주세요");
|
||||
$('#startDate').focus();
|
||||
this.checked = false;
|
||||
}
|
||||
|
||||
if(this.checked){
|
||||
$(this).attr('value', 'Y');
|
||||
$("#endDate").val(dateString);
|
||||
$("#endDate").attr("disabled",true);
|
||||
}else{
|
||||
$(this).attr('value', 'N');
|
||||
$("#endDate").val('');
|
||||
$("#endDate").removeAttr("disabled");
|
||||
}
|
||||
console.log($("#inOfficeYn").val());
|
||||
|
||||
|
||||
if($("#startDate").val() == ""){
|
||||
alert("근무시작일을 입력해주세요");
|
||||
$('#startDate').focus();
|
||||
this.checked = false;
|
||||
}
|
||||
|
||||
$("#endDate").val('');
|
||||
if(this.checked){
|
||||
$(this).attr('value', 'Y');
|
||||
$("#endDate").attr("disabled",true);
|
||||
}else{
|
||||
$(this).attr('value', 'N');
|
||||
$("#endDate").removeAttr("disabled");
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
</th:block>
|
||||
</th:block>
|
||||
<td th:text="${#temporals.format(career.startDate, 'yyyy-MM-dd')}"></td>
|
||||
<td th:text="${#temporals.format(career.endDate, 'yyyy-MM-dd')}"></td>
|
||||
<td th:text="${career.inOfficeYn eq 'Y'?'재직중':#temporals.format(career.endDate, 'yyyy-MM-dd')}"></td>
|
||||
<td th:text="${career.workDay}"></td>
|
||||
<td th:text="${career.workMonth}"></td>
|
||||
<td>
|
||||
|
|
|
|||
Loading…
Reference in New Issue