Merge branch 'susu' into dev
# Conflicts: # front/src/main/resources/static/assets/scripts/common.ui.js # front/src/main/resources/static/assets/styles/style.css
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
package app.module.front.usecase.daily.expense.adapters.persistence;
|
||||
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.config.application.util.SftpFileDeleteUtil;
|
||||
import app.module.core.usecase.file.updateFile.adapters.persistence.UpdateFileMapper;
|
||||
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
||||
import app.module.front.usecase.daily.expense.ports.DailyExpensePortOut;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.CreateDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.GetDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.RemoveDailyExpenseCmd;
|
||||
import com.jcraft.jsch.JSchException;
|
||||
import com.jcraft.jsch.SftpException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@@ -41,6 +47,7 @@ public class DailyExpenseDao implements DailyExpensePortOut {
|
||||
Integer existCount = dailyExpenseMapper.getRecordExistCount(findCmd);
|
||||
if (existCount != 0) {
|
||||
dailyExpenseMapper.removeDailyExpense(command);
|
||||
dailyExpenseMapper.removeDailyExpenseReceipt(command);
|
||||
|
||||
log.debug("[RemoveDailyExpense] record={}", command);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import app.module.front.usecase.daily.expense.ports.application.domain.CreateDai
|
||||
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.GetDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.RemoveDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -47,4 +46,11 @@ public interface DailyExpenseMapper {
|
||||
* @param command 삭제 데이터
|
||||
*/
|
||||
void removeDailyExpense(RemoveDailyExpenseCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 지출 영수증 삭제
|
||||
*
|
||||
* @param command 삭제 데이터
|
||||
*/
|
||||
void removeDailyExpenseReceipt(RemoveDailyExpenseCmd command);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class DailyIncomeDao implements DailyIncomePortOut {
|
||||
Integer existCount = dailyIncomeMapper.getRecordExistCount(findCmd);
|
||||
if (existCount != 0) {
|
||||
dailyIncomeMapper.removeDailyIncome(command);
|
||||
|
||||
dailyIncomeMapper.removeDailyIncomeReceipt(command);
|
||||
log.debug("[RemoveDailyIncome] record={}", command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,4 +46,11 @@ public interface DailyIncomeMapper {
|
||||
* @param command 삭제 데이터
|
||||
*/
|
||||
void removeDailyIncome(RemoveDailyIncomeCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 수입 영수증 삭제
|
||||
*
|
||||
* @param command 삭제 데이터
|
||||
*/
|
||||
void removeDailyIncomeReceipt(RemoveDailyIncomeCmd command);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.front.usecase.daily.receipt.adapters.persistence;
|
||||
|
||||
import app.module.core.config.application.annotation.CreateCommand;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.front.usecase.daily.receipt.adapters.web.model.CreateReceiptHasFileReqVO;
|
||||
import app.module.front.usecase.daily.receipt.ports.DailyReceiptPortOut;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -22,4 +23,10 @@ public class DailyReceiptDao implements DailyReceiptPortOut {
|
||||
public void insertReceiptMappingFile(CreateReceiptHasFileReqVO command) {
|
||||
dailyReceiptMapper.insertReceiptMappingFile(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectReceiptCount(String inputType) {
|
||||
|
||||
return dailyReceiptMapper.selectReceiptCount(inputType, CommonUtil.getLoginUsername());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.receipt.adapters.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.receipt.adapters.web.model.CreateReceiptHasFileReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
||||
@Mapper
|
||||
@@ -16,4 +17,13 @@ public interface DailyReceiptMapper {
|
||||
*/
|
||||
Integer insertReceiptMappingFile(CreateReceiptHasFileReqVO command);
|
||||
|
||||
/**
|
||||
* 일계부 수입 파일 매핑
|
||||
*
|
||||
* @param inputType 수입/지출
|
||||
* @param userId 사용자 아이디
|
||||
* @return 중복 개수
|
||||
*/
|
||||
Integer selectReceiptCount(@Param("inputType") String inputType,@Param("userId")String userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import app.module.front.usecase.daily.expense.adapters.web.model.CreateDailyExpe
|
||||
import app.module.front.usecase.daily.expense.ports.DailyExpensePortIn;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.CreateDailyIncomeReqVO;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.DailyInputType;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.RemoveDailyIncomeReqVO;
|
||||
import app.module.front.usecase.daily.income.ports.DailyIncomePortIn;
|
||||
import app.module.front.usecase.daily.receipt.adapters.web.model.*;
|
||||
import app.module.front.usecase.daily.receipt.ports.DailyReceiptPortIn;
|
||||
@@ -25,7 +26,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
@@ -105,7 +105,7 @@ public class DailyReceiptController {
|
||||
|
||||
|
||||
/**
|
||||
* 일계부 영수증 수입 등록 처리
|
||||
* 일계부 영수증 수입/수출 등록 처리
|
||||
*
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
* @param groupNo 검색 그룹
|
||||
@@ -196,6 +196,15 @@ public class DailyReceiptController {
|
||||
return ResponseEntity.status(HttpStatus.OK).body("");
|
||||
}
|
||||
|
||||
/**
|
||||
* 일계부 영수증 개수 확인
|
||||
*
|
||||
*/
|
||||
@GetMapping(path = "/{inputType}/count")
|
||||
ResponseEntity<?> receiptCount(@PathVariable("inputType") String inputType) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body( dailyReceiptPortIn.selectReceiptCount(inputType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 일계부 유효성 체크 및 데이터 조회
|
||||
*
|
||||
|
||||
@@ -6,9 +6,15 @@ import app.module.front.usecase.daily.receipt.adapters.web.model.CreateReceiptHa
|
||||
public interface DailyReceiptPortIn {
|
||||
|
||||
/**
|
||||
* 일계부 수입 파일 매핑 추가
|
||||
* 일계부 영수증 파일 매핑 추가
|
||||
*
|
||||
*/
|
||||
void insertReceiptMappingFile(CreateReceiptHasFileReqVO formVO);
|
||||
|
||||
/**
|
||||
* 일계부 영수증 파일 개수
|
||||
*
|
||||
*/
|
||||
Integer selectReceiptCount(String inputType);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,4 +12,12 @@ public interface DailyReceiptPortOut {
|
||||
* @param command 수입 영수증 매핑 검색 조건
|
||||
*/
|
||||
void insertReceiptMappingFile(CreateReceiptHasFileReqVO command);
|
||||
|
||||
/**
|
||||
* 일계부 수입 영수증 매핑
|
||||
*
|
||||
|
||||
* @param inputType 수출/수입
|
||||
*/
|
||||
Integer selectReceiptCount(String inputType);
|
||||
}
|
||||
|
||||
@@ -16,4 +16,11 @@ public class DailyReceiptService implements DailyReceiptPortIn {
|
||||
public void insertReceiptMappingFile(CreateReceiptHasFileReqVO formVO) {
|
||||
portOut.insertReceiptMappingFile(formVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectReceiptCount(String inputType) {
|
||||
return portOut.selectReceiptCount(inputType);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -69,4 +69,14 @@
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<update id="removeDailyExpenseReceipt">
|
||||
update receipt_has_record set
|
||||
<include refid="common.fields.DeleteBaseSet"/>
|
||||
where is_deleted = false
|
||||
and type = 'EXPENSE'
|
||||
<if test="id != null and id != ''">
|
||||
and receipt_type_id = #{id}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -70,4 +70,14 @@
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<update id="removeDailyIncomeReceipt">
|
||||
update receipt_has_record set
|
||||
<include refid="common.fields.DeleteBaseSet"/>
|
||||
where is_deleted = false
|
||||
and type = 'INCOME'
|
||||
<if test="id != null and id != ''">
|
||||
and receipt_type_id = #{id}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -17,4 +17,12 @@
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="selectReceiptCount">
|
||||
select count(*)
|
||||
from receipt_has_record
|
||||
where created_by = #{userId}
|
||||
and created_at = CURRENT_DATE
|
||||
and type = #{inputType}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -330,6 +330,5 @@ var ajaxUtil = {
|
||||
ajaxUtil.loadingStatus = true;
|
||||
// TODO : 로딩바 활성화
|
||||
document.querySelector('#loadingBar').style.display = 'block';
|
||||
debugger
|
||||
},
|
||||
};
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<body>
|
||||
<div id="wrap">
|
||||
<div class="loading" id="loadingBar" style="display: none"><i class="ico-spinner" aria-hidden="true"></i></div>
|
||||
<div class="loading dimmed" id="loadingBar" style="display: none"><i class="ico-spinner" aria-hidden="true"></i></div>
|
||||
<section th:replace="~{common/components :: header(true)}"></section>
|
||||
|
||||
<div id="container" layout:fragment="content">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<body>
|
||||
<div id="wrap">
|
||||
<div class="loading" id="loadingBar" style="display: none"><i class="ico-spinner" aria-hidden="true"></i></div>
|
||||
<div class="loading dimmed" id="loadingBar" style="display: none"><i class="ico-spinner" aria-hidden="true"></i></div>
|
||||
<section th:replace="~{common/components :: header(true)}"></section>
|
||||
|
||||
<div id="container" layout:fragment="content">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<body>
|
||||
<div id="wrap">
|
||||
<div class="loading" id="loadingBar" style="display: none"><i class="ico-spinner" aria-hidden="true"></i></div>
|
||||
<div class="loading dimmed" id="loadingBar" style="display: none"><i class="ico-spinner" aria-hidden="true"></i></div>
|
||||
<section th:replace="~{common/components :: header(false)}"></section>
|
||||
|
||||
<div id="container" layout:fragment="content">
|
||||
|
||||
@@ -206,6 +206,7 @@
|
||||
<!--/* 영수증 등록 s */-->
|
||||
<div id="modelOcr" style="display: none;">
|
||||
<section class="form-group">
|
||||
<input type="hidden" id="countOcr"/>
|
||||
<div class="segment-label">
|
||||
<p class="label-txt">
|
||||
영수증 첨부
|
||||
|
||||
@@ -248,10 +248,36 @@
|
||||
$('#modelOcr').hide();
|
||||
$('#btnOcr').removeClass('active');
|
||||
} else {
|
||||
$('#modelSelf').hide();
|
||||
$('#btnSelf').removeClass('active');
|
||||
$('#modelOcr').show();
|
||||
$('#btnOcr').addClass('active');
|
||||
ajaxUtil._ajaxSyncMethod(
|
||||
'/api/record/receipt/INCOME/count',
|
||||
{},
|
||||
(response) => { // 성공
|
||||
if(response < 3) {
|
||||
debugger
|
||||
$('#modelSelf').hide();
|
||||
$('#btnSelf').removeClass('active');
|
||||
$('#modelOcr').show();
|
||||
$('#btnOcr').addClass('active');
|
||||
$('#countOcr').val(response);
|
||||
}else{
|
||||
etUI.dialog.alert({
|
||||
title: '',
|
||||
message: '영수증은 일일 최대 3개 등록 가능합니다.',
|
||||
type: 'alert',
|
||||
callback: function () {
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
function (code, rstData) { // 실패
|
||||
console.log("error : ", code);
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
createVaild() {
|
||||
@@ -272,14 +298,25 @@
|
||||
);
|
||||
},
|
||||
addFileInput() {
|
||||
// 새로운 input type="file" 요소 생성
|
||||
const countOcr = $('#countOcr').val();
|
||||
if(uploadedReceipt.length === 3 - countOcr ){
|
||||
etUI.dialog.alert({
|
||||
title: '',
|
||||
message: '영수증은 일일 최대 3개 등록 가능합니다.',
|
||||
type: 'alert',
|
||||
callback: function () {
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const fileInput = document.createElement('input');
|
||||
fileInput.type = 'file';
|
||||
fileInput.accept = 'image/*';
|
||||
fileInput.style.display = 'none';
|
||||
fileInput.name = 'file';
|
||||
|
||||
// 파일 선택 시 이벤트 처리
|
||||
// 파일 선택
|
||||
fileInput.addEventListener('change', (event) => {
|
||||
const files = event.target.files;
|
||||
const previewContainer = $('#file-upload-container');
|
||||
@@ -330,7 +367,6 @@
|
||||
`);
|
||||
previewContainer.append(fileItem);
|
||||
|
||||
// 파일 정보와 서버 응답 저장
|
||||
uploadedReceipt.push({
|
||||
fileId: fileItemId,
|
||||
file: file,
|
||||
@@ -383,8 +419,8 @@
|
||||
const receiptDataList = uploadedReceipt;
|
||||
if (!receiptDataList.length) {
|
||||
etUI.dialog.alert({
|
||||
title: '등록 실패',
|
||||
message: '등록할 영수증 데이터가 없습니다.',
|
||||
title: '',
|
||||
message: '최소 1개의 영수증을 등록해주셔야 합니다.',
|
||||
type: 'alert',
|
||||
callback: function () {
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user