영수증 삭제 및 일일 개수 추가
This commit is contained in:
@@ -22,10 +22,12 @@ public class RemoveDailyDao implements RemoveDailyPortOut {
|
|||||||
|
|
||||||
if (DailySort.INCOME.equals(command.getCurrentStep())) {
|
if (DailySort.INCOME.equals(command.getCurrentStep())) {
|
||||||
mapper.removeDailyIncome(command);
|
mapper.removeDailyIncome(command);
|
||||||
|
mapper.removeDailyIncomeReceipt(command);
|
||||||
} else if (DailySort.WORK.equals(command.getCurrentStep())) {
|
} else if (DailySort.WORK.equals(command.getCurrentStep())) {
|
||||||
mapper.removeDailyWork(command);
|
mapper.removeDailyWork(command);
|
||||||
} else if (DailySort.EXPENSE.equals(command.getCurrentStep())) {
|
} else if (DailySort.EXPENSE.equals(command.getCurrentStep())) {
|
||||||
mapper.removeDailyExpense(command);
|
mapper.removeDailyExpense(command);
|
||||||
|
mapper.removeDailyExpenseReceipt(command);
|
||||||
} else if (DailySort.POWER.equals(command.getCurrentStep())) {
|
} else if (DailySort.POWER.equals(command.getCurrentStep())) {
|
||||||
mapper.removeDailyPower(command);
|
mapper.removeDailyPower(command);
|
||||||
} else if (DailySort.FORESTRY.equals(command.getCurrentStep())) {
|
} else if (DailySort.FORESTRY.equals(command.getCurrentStep())) {
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ public interface RemoveDailyMapper {
|
|||||||
*/
|
*/
|
||||||
void removeDailyIncome(RemoveDailyCmd command);
|
void removeDailyIncome(RemoveDailyCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 특정일의 수입 영수증 전체 삭제
|
||||||
|
* @param command 검색 조건
|
||||||
|
*/
|
||||||
|
void removeDailyIncomeReceipt(RemoveDailyCmd command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 특정일의 임업노동 투입 전체 삭제
|
* 특정일의 임업노동 투입 전체 삭제
|
||||||
* @param command 검색 조건
|
* @param command 검색 조건
|
||||||
@@ -23,6 +29,12 @@ public interface RemoveDailyMapper {
|
|||||||
*/
|
*/
|
||||||
void removeDailyExpense(RemoveDailyCmd command);
|
void removeDailyExpense(RemoveDailyCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 특정일의 지출 영수증 전체 삭제
|
||||||
|
* @param command 검색 조건
|
||||||
|
*/
|
||||||
|
void removeDailyExpenseReceipt(RemoveDailyCmd command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 동력 사용시간 전체 삭제
|
* 동력 사용시간 전체 삭제
|
||||||
* @param command 검색 조건
|
* @param command 검색 조건
|
||||||
|
|||||||
@@ -14,6 +14,19 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="removeDailyIncomeReceipt">
|
||||||
|
<if test="removeIds != null and removeIds != ''">
|
||||||
|
update receipt_has_record set
|
||||||
|
<include refid="common.fields.DeleteBaseSet"/>
|
||||||
|
where is_deleted = false
|
||||||
|
and type = 'INCOME'
|
||||||
|
and receipt_type_id IN
|
||||||
|
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="removeDailyWork">
|
<select id="removeDailyWork">
|
||||||
<if test="removeIds != null and removeIds != ''">
|
<if test="removeIds != null and removeIds != ''">
|
||||||
update daily_work set
|
update daily_work set
|
||||||
@@ -38,6 +51,19 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="removeDailyExpenseReceipt">
|
||||||
|
<if test="removeIds != null and removeIds != ''">
|
||||||
|
update receipt_has_record set
|
||||||
|
<include refid="common.fields.DeleteBaseSet"/>
|
||||||
|
where is_deleted = false
|
||||||
|
and type = 'EXPENSE'
|
||||||
|
and receipt_type_id IN
|
||||||
|
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="removeDailyPower">
|
<select id="removeDailyPower">
|
||||||
<if test="removeIds != null and removeIds != ''">
|
<if test="removeIds != null and removeIds != ''">
|
||||||
update daily_power set
|
update daily_power set
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import app.module.core.config.application.util.CommonUtil;
|
|||||||
import app.module.core.config.application.util.SftpFileDeleteUtil;
|
import app.module.core.config.application.util.SftpFileDeleteUtil;
|
||||||
import app.module.core.usecase.file.updateFile.adapters.persistence.UpdateFileMapper;
|
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.adapters.persistence.model.DailyExpenseDto;
|
||||||
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseTypeCount;
|
|
||||||
import app.module.front.usecase.daily.expense.ports.DailyExpensePortOut;
|
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.CreateDailyExpenseCmd;
|
||||||
import app.module.front.usecase.daily.expense.ports.application.domain.GetDailyExpenseCmd;
|
import app.module.front.usecase.daily.expense.ports.application.domain.GetDailyExpenseCmd;
|
||||||
@@ -23,10 +22,6 @@ import java.util.List;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class DailyExpenseDao implements DailyExpensePortOut {
|
public class DailyExpenseDao implements DailyExpensePortOut {
|
||||||
private final DailyExpenseMapper dailyExpenseMapper;
|
private final DailyExpenseMapper dailyExpenseMapper;
|
||||||
private final UpdateFileMapper updateFileMapper;
|
|
||||||
@Value("${path.upload.storage}")
|
|
||||||
private String uploadStorageType;
|
|
||||||
private final SftpFileDeleteUtil sftpFileDeleteUtil;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DailyExpenseDto> list(GetDailyExpenseCmd command) {
|
public List<DailyExpenseDto> list(GetDailyExpenseCmd command) {
|
||||||
@@ -49,26 +44,10 @@ public class DailyExpenseDao implements DailyExpensePortOut {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(GetDailyExpenseCmd findCmd, RemoveDailyExpenseCmd command) {
|
public void remove(GetDailyExpenseCmd findCmd, RemoveDailyExpenseCmd command) {
|
||||||
DailyExpenseTypeCount existCount = dailyExpenseMapper.getRecordExistTypeCount(findCmd);
|
Integer existCount = dailyExpenseMapper.getRecordExistCount(findCmd);
|
||||||
if (existCount.getCount() != 0) {
|
if (existCount != 0) {
|
||||||
dailyExpenseMapper.removeDailyExpense(command);
|
dailyExpenseMapper.removeDailyExpense(command);
|
||||||
if("OCR".equals(existCount.getInputType().name())){
|
dailyExpenseMapper.removeDailyExpenseReceipt(command);
|
||||||
dailyExpenseMapper.removeDailyExpenseReceipt(command);
|
|
||||||
if(existCount.getFileIdCount() == 1){
|
|
||||||
if("SFTP".equals(uploadStorageType)){
|
|
||||||
try {
|
|
||||||
sftpFileDeleteUtil.deleteRealFile(existCount.getFileId());
|
|
||||||
} catch (JSchException | SftpException e) {
|
|
||||||
log.error("SFTP 오류 e.getMessage={}", e.getMessage());
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (Exception ignored){
|
|
||||||
log.error(ignored.getMessage());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
updateFileMapper.deleteReceiptFile(existCount.getFileId(), CommonUtil.getLoginUsername());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.debug("[RemoveDailyExpense] record={}", command);
|
log.debug("[RemoveDailyExpense] record={}", command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
package app.module.front.usecase.daily.expense.adapters.persistence;
|
package app.module.front.usecase.daily.expense.adapters.persistence;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseTypeCount;
|
|
||||||
import app.module.front.usecase.daily.expense.ports.application.domain.CreateDailyExpenseCmd;
|
import app.module.front.usecase.daily.expense.ports.application.domain.CreateDailyExpenseCmd;
|
||||||
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
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.GetDailyExpenseCmd;
|
||||||
import app.module.front.usecase.daily.expense.ports.application.domain.RemoveDailyExpenseCmd;
|
import app.module.front.usecase.daily.expense.ports.application.domain.RemoveDailyExpenseCmd;
|
||||||
import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIReqVO;
|
|
||||||
import app.module.front.usecase.daily.income.ports.application.domain.RemoveDailyIncomeCmd;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -29,13 +26,6 @@ public interface DailyExpenseMapper {
|
|||||||
*/
|
*/
|
||||||
Integer getRecordExistCount(GetDailyExpenseCmd command);
|
Integer getRecordExistCount(GetDailyExpenseCmd command);
|
||||||
|
|
||||||
/**
|
|
||||||
* 일계부 지출 데이터 존재 여부
|
|
||||||
*
|
|
||||||
* @param command 검색 조건
|
|
||||||
* @return 중복 개수
|
|
||||||
*/
|
|
||||||
DailyExpenseTypeCount getRecordExistTypeCount(GetDailyExpenseCmd command);
|
|
||||||
/**
|
/**
|
||||||
* 일계부 지출 등록
|
* 일계부 지출 등록
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package app.module.front.usecase.daily.expense.adapters.persistence.model;
|
|
||||||
|
|
||||||
import app.module.front.usecase.daily.income.adapters.web.model.DailyInputType;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public class DailyExpenseTypeCount {
|
|
||||||
private Long count;
|
|
||||||
private DailyInputType inputType;
|
|
||||||
private Long fileId;
|
|
||||||
private Long fileIdCount;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,20 +1,12 @@
|
|||||||
package app.module.front.usecase.daily.income.adapters.persistence;
|
package app.module.front.usecase.daily.income.adapters.persistence;
|
||||||
|
|
||||||
import app.module.core.config.application.util.CommonUtil;
|
|
||||||
import app.module.core.config.application.util.SftpFileDeleteUtil;
|
|
||||||
import app.module.core.usecase.file.getFile.adapters.persistence.GetFileMapper;
|
|
||||||
import app.module.core.usecase.file.updateFile.adapters.persistence.UpdateFileMapper;
|
|
||||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeTypeCount;
|
|
||||||
import app.module.front.usecase.daily.income.ports.DailyIncomePortOut;
|
import app.module.front.usecase.daily.income.ports.DailyIncomePortOut;
|
||||||
import app.module.front.usecase.daily.income.ports.application.domain.CreateDailyIncomeCmd;
|
import app.module.front.usecase.daily.income.ports.application.domain.CreateDailyIncomeCmd;
|
||||||
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||||
import app.module.front.usecase.daily.income.ports.application.domain.RemoveDailyIncomeCmd;
|
import app.module.front.usecase.daily.income.ports.application.domain.RemoveDailyIncomeCmd;
|
||||||
import com.jcraft.jsch.JSchException;
|
|
||||||
import com.jcraft.jsch.SftpException;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -24,10 +16,6 @@ import java.util.List;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class DailyIncomeDao implements DailyIncomePortOut {
|
public class DailyIncomeDao implements DailyIncomePortOut {
|
||||||
private final DailyIncomeMapper dailyIncomeMapper;
|
private final DailyIncomeMapper dailyIncomeMapper;
|
||||||
private final UpdateFileMapper updateFileMapper;
|
|
||||||
@Value("${path.upload.storage}")
|
|
||||||
private String uploadStorageType;
|
|
||||||
private final SftpFileDeleteUtil sftpFileDeleteUtil;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DailyIncomeDto> list(GetDailyIncomeCmd command) {
|
public List<DailyIncomeDto> list(GetDailyIncomeCmd command) {
|
||||||
@@ -50,27 +38,10 @@ public class DailyIncomeDao implements DailyIncomePortOut {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(GetDailyIncomeCmd findCmd, RemoveDailyIncomeCmd command) {
|
public void remove(GetDailyIncomeCmd findCmd, RemoveDailyIncomeCmd command) {
|
||||||
DailyIncomeTypeCount existCount = dailyIncomeMapper.getRecordExistTypeCount(findCmd);
|
Integer existCount = dailyIncomeMapper.getRecordExistCount(findCmd);
|
||||||
if (existCount.getCount() != 0) {
|
if (existCount != 0) {
|
||||||
dailyIncomeMapper.removeDailyIncome(command);
|
dailyIncomeMapper.removeDailyIncome(command);
|
||||||
|
dailyIncomeMapper.removeDailyIncomeReceipt(command);
|
||||||
if("OCR".equals(existCount.getInputType().name())){
|
|
||||||
dailyIncomeMapper.removeDailyIncomeReceipt(command);
|
|
||||||
if(existCount.getFileIdCount() == 1){
|
|
||||||
if("SFTP".equals(uploadStorageType)){
|
|
||||||
try {
|
|
||||||
sftpFileDeleteUtil.deleteRealFile(existCount.getFileId());
|
|
||||||
} catch (JSchException | SftpException e) {
|
|
||||||
log.error("SFTP 오류 e.getMessage={}", e.getMessage());
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (Exception ignored){
|
|
||||||
log.error(ignored.getMessage());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
updateFileMapper.deleteReceiptFile(existCount.getFileId(), CommonUtil.getLoginUsername());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.debug("[RemoveDailyIncome] record={}", command);
|
log.debug("[RemoveDailyIncome] record={}", command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package app.module.front.usecase.daily.income.adapters.persistence;
|
package app.module.front.usecase.daily.income.adapters.persistence;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeTypeCount;
|
|
||||||
import app.module.front.usecase.daily.income.ports.application.domain.CreateDailyIncomeCmd;
|
import app.module.front.usecase.daily.income.ports.application.domain.CreateDailyIncomeCmd;
|
||||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||||
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||||
@@ -27,13 +26,6 @@ public interface DailyIncomeMapper {
|
|||||||
*/
|
*/
|
||||||
Integer getRecordExistCount(GetDailyIncomeCmd command);
|
Integer getRecordExistCount(GetDailyIncomeCmd command);
|
||||||
|
|
||||||
/**
|
|
||||||
* 일계부 수입 데이터 존재 여부, OCR 여부 , 매핑된 첨부파일 개수 확인
|
|
||||||
*
|
|
||||||
* @param command 검색 조건
|
|
||||||
* @return 중복 개수
|
|
||||||
*/
|
|
||||||
DailyIncomeTypeCount getRecordExistTypeCount(GetDailyIncomeCmd command);
|
|
||||||
/**
|
/**
|
||||||
* 일계부 수입 등록
|
* 일계부 수입 등록
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package app.module.front.usecase.daily.income.adapters.persistence.model;
|
|
||||||
|
|
||||||
import app.module.front.usecase.daily.income.adapters.web.model.DailyInputType;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public class DailyIncomeTypeCount {
|
|
||||||
private Long count;
|
|
||||||
private DailyInputType inputType;
|
|
||||||
private Long fileId;
|
|
||||||
private Long fileIdCount;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package app.module.front.usecase.daily.receipt.adapters.persistence;
|
package app.module.front.usecase.daily.receipt.adapters.persistence;
|
||||||
|
|
||||||
import app.module.core.config.application.annotation.CreateCommand;
|
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.adapters.web.model.CreateReceiptHasFileReqVO;
|
||||||
import app.module.front.usecase.daily.receipt.ports.DailyReceiptPortOut;
|
import app.module.front.usecase.daily.receipt.ports.DailyReceiptPortOut;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -22,4 +23,10 @@ public class DailyReceiptDao implements DailyReceiptPortOut {
|
|||||||
public void insertReceiptMappingFile(CreateReceiptHasFileReqVO command) {
|
public void insertReceiptMappingFile(CreateReceiptHasFileReqVO command) {
|
||||||
dailyReceiptMapper.insertReceiptMappingFile(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 app.module.front.usecase.daily.receipt.adapters.web.model.CreateReceiptHasFileReqVO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@@ -16,4 +17,13 @@ public interface DailyReceiptMapper {
|
|||||||
*/
|
*/
|
||||||
Integer insertReceiptMappingFile(CreateReceiptHasFileReqVO command);
|
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.expense.ports.DailyExpensePortIn;
|
||||||
import app.module.front.usecase.daily.income.adapters.web.model.CreateDailyIncomeReqVO;
|
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.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.income.ports.DailyIncomePortIn;
|
||||||
import app.module.front.usecase.daily.receipt.adapters.web.model.*;
|
import app.module.front.usecase.daily.receipt.adapters.web.model.*;
|
||||||
import app.module.front.usecase.daily.receipt.ports.DailyReceiptPortIn;
|
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.http.*;
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
import org.springframework.validation.BindingResult;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
@@ -105,7 +105,7 @@ public class DailyReceiptController {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 영수증 수입 등록 처리
|
* 일계부 영수증 수입/수출 등록 처리
|
||||||
*
|
*
|
||||||
* @param searchMonth 검색 월(yyyyMM)
|
* @param searchMonth 검색 월(yyyyMM)
|
||||||
* @param groupNo 검색 그룹
|
* @param groupNo 검색 그룹
|
||||||
@@ -196,6 +196,15 @@ public class DailyReceiptController {
|
|||||||
return ResponseEntity.status(HttpStatus.OK).body("");
|
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 {
|
public interface DailyReceiptPortIn {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 수입 파일 매핑 추가
|
* 일계부 영수증 파일 매핑 추가
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void insertReceiptMappingFile(CreateReceiptHasFileReqVO formVO);
|
void insertReceiptMappingFile(CreateReceiptHasFileReqVO formVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 영수증 파일 개수
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Integer selectReceiptCount(String inputType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,12 @@ public interface DailyReceiptPortOut {
|
|||||||
* @param command 수입 영수증 매핑 검색 조건
|
* @param command 수입 영수증 매핑 검색 조건
|
||||||
*/
|
*/
|
||||||
void insertReceiptMappingFile(CreateReceiptHasFileReqVO 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) {
|
public void insertReceiptMappingFile(CreateReceiptHasFileReqVO formVO) {
|
||||||
portOut.insertReceiptMappingFile(formVO);
|
portOut.insertReceiptMappingFile(formVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer selectReceiptCount(String inputType) {
|
||||||
|
return portOut.selectReceiptCount(inputType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,27 +27,6 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRecordExistTypeCount">
|
|
||||||
select count(1) as count,
|
|
||||||
ds.input_type,
|
|
||||||
rhr.file_id,
|
|
||||||
COALESCE(fc.file_id_count, 0) as file_id_count
|
|
||||||
from daily_expense ds
|
|
||||||
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
|
||||||
left join
|
|
||||||
receipt_has_record rhr on ds.id = rhr.receipt_type_id and rhr.is_deleted = false
|
|
||||||
left join (
|
|
||||||
select file_id,COUNT(*) AS file_id_count
|
|
||||||
FROM receipt_has_record
|
|
||||||
where is_deleted = false and type = 'EXPENSE'
|
|
||||||
group by file_id
|
|
||||||
) fc on fc.file_id = rhr.file_id
|
|
||||||
where ds.is_deleted = false
|
|
||||||
<if test="id != null and id != '0'">
|
|
||||||
and ds.id = #{id}
|
|
||||||
</if>
|
|
||||||
group by ds.id,rhr.file_id,fc.file_id_count
|
|
||||||
</select>
|
|
||||||
<insert id="createDailyExpense" useGeneratedKeys="true" keyProperty="id">
|
<insert id="createDailyExpense" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into daily_expense (
|
insert into daily_expense (
|
||||||
daily_record_seq, input_type, category, income_mark
|
daily_record_seq, input_type, category, income_mark
|
||||||
@@ -94,8 +73,9 @@
|
|||||||
update receipt_has_record set
|
update receipt_has_record set
|
||||||
<include refid="common.fields.DeleteBaseSet"/>
|
<include refid="common.fields.DeleteBaseSet"/>
|
||||||
where is_deleted = false
|
where is_deleted = false
|
||||||
|
and type = 'EXPENSE'
|
||||||
<if test="id != null and id != ''">
|
<if test="id != null and id != ''">
|
||||||
and receipt_type_id = #{id}
|
and receipt_type_id = #{id}
|
||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|||||||
@@ -27,30 +27,6 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRecordExistTypeCount">
|
|
||||||
select count(1) as count,
|
|
||||||
ds.input_type,
|
|
||||||
rhr.file_id,
|
|
||||||
COALESCE(fc.file_id_count, 0) as file_id_count
|
|
||||||
from daily_income ds
|
|
||||||
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
|
||||||
left join
|
|
||||||
receipt_has_record rhr on ds.id = rhr.receipt_type_id and rhr.is_deleted = false
|
|
||||||
left join (
|
|
||||||
select file_id,COUNT(*) AS file_id_count
|
|
||||||
FROM receipt_has_record
|
|
||||||
where is_deleted = false and type = 'INCOME'
|
|
||||||
group by file_id
|
|
||||||
) fc on fc.file_id = rhr.file_id
|
|
||||||
where ds.is_deleted = false
|
|
||||||
<if test="id != null and id != '0'">
|
|
||||||
and ds.id = #{id}
|
|
||||||
</if>
|
|
||||||
group by ds.id,rhr.file_id,fc.file_id_count
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
|
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into daily_income (
|
insert into daily_income (
|
||||||
daily_record_seq, input_type, category, expense_mark
|
daily_record_seq, input_type, category, expense_mark
|
||||||
@@ -98,8 +74,9 @@
|
|||||||
update receipt_has_record set
|
update receipt_has_record set
|
||||||
<include refid="common.fields.DeleteBaseSet"/>
|
<include refid="common.fields.DeleteBaseSet"/>
|
||||||
where is_deleted = false
|
where is_deleted = false
|
||||||
|
and type = 'INCOME'
|
||||||
<if test="id != null and id != ''">
|
<if test="id != null and id != ''">
|
||||||
and receipt_type_id = #{id}
|
and receipt_type_id = #{id}
|
||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|||||||
@@ -17,4 +17,12 @@
|
|||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<select id="selectReceiptCount">
|
||||||
|
select count(*)
|
||||||
|
from receipt_has_record
|
||||||
|
where created_by = #{userId}
|
||||||
|
and created_at = CURRENT_DATE
|
||||||
|
and type = #{inputType}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -206,6 +206,7 @@
|
|||||||
<!--/* 영수증 등록 s */-->
|
<!--/* 영수증 등록 s */-->
|
||||||
<div id="modelOcr" style="display: none;">
|
<div id="modelOcr" style="display: none;">
|
||||||
<section class="form-group">
|
<section class="form-group">
|
||||||
|
<input type="hidden" id="countOcr"/>
|
||||||
<div class="segment-label">
|
<div class="segment-label">
|
||||||
<p class="label-txt">
|
<p class="label-txt">
|
||||||
영수증 첨부
|
영수증 첨부
|
||||||
|
|||||||
@@ -248,10 +248,36 @@
|
|||||||
$('#modelOcr').hide();
|
$('#modelOcr').hide();
|
||||||
$('#btnOcr').removeClass('active');
|
$('#btnOcr').removeClass('active');
|
||||||
} else {
|
} else {
|
||||||
$('#modelSelf').hide();
|
ajaxUtil._ajaxSyncMethod(
|
||||||
$('#btnSelf').removeClass('active');
|
'/api/record/receipt/INCOME/count',
|
||||||
$('#modelOcr').show();
|
{},
|
||||||
$('#btnOcr').addClass('active');
|
(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() {
|
createVaild() {
|
||||||
@@ -272,9 +298,17 @@
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
addFileInput() {
|
addFileInput() {
|
||||||
// 여기에서 파일 첨부 몇개인지 확인하고 하루 3개,,,, 총 6개씩,,,
|
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');
|
const fileInput = document.createElement('input');
|
||||||
fileInput.type = 'file';
|
fileInput.type = 'file';
|
||||||
@@ -385,8 +419,8 @@
|
|||||||
const receiptDataList = uploadedReceipt;
|
const receiptDataList = uploadedReceipt;
|
||||||
if (!receiptDataList.length) {
|
if (!receiptDataList.length) {
|
||||||
etUI.dialog.alert({
|
etUI.dialog.alert({
|
||||||
title: '등록 실패',
|
title: '',
|
||||||
message: '등록할 영수증 데이터가 없습니다.',
|
message: '최소 1개의 영수증을 등록해주셔야 합니다.',
|
||||||
type: 'alert',
|
type: 'alert',
|
||||||
callback: function () {
|
callback: function () {
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user