Merge branch 'kangsun' into 'dev'
[BO] 임가현황 > 은행자동이체 내역 탭 작업 See merge request korea-research/korea-research!73
This commit is contained in:
@@ -10,8 +10,10 @@ import org.springframework.stereotype.Repository;
|
|||||||
@Repository
|
@Repository
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class GetMonthlyInputStatusDao implements GetMonthlyInputStatusPortOut {
|
class GetMonthlyInputStatusDao implements GetMonthlyInputStatusPortOut {
|
||||||
|
private final GetMonthlyInputStatusMapper mapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd cmd) {
|
public Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd cmd) {
|
||||||
return Optional.empty();
|
return mapper.getMonthlyInputStatus(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,10 @@ package app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputSta
|
|||||||
|
|
||||||
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||||
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
public interface GetMonthlyInputStatusMapper {
|
public interface GetMonthlyInputStatusMapper {
|
||||||
GetMonthlyInputStatus getMonthlyInputStatus(GetMonthlyInputStatusCmd cmd);
|
Optional<GetMonthlyInputStatus> getMonthlyInputStatus(GetMonthlyInputStatusCmd cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
public interface UpdateMonthlyInputStatusMapper {
|
public interface UpdateMonthlyInputStatusMapper {
|
||||||
void updateForestProductStatus(UpdateForestProductStatusCmd cmd);
|
void updateForestProductStatus(UpdateForestProductStatusCmd cmd);
|
||||||
void updateBankInputStatus(UpdateForestProductStatusCmd cmd);
|
void updateBankInputStatus(UpdateForestProductStatusCmd cmd);
|
||||||
|
void updateBankOutputStatus(UpdateForestProductStatusCmd cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.adapters.persistence;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain.GetBankAutoTransferExpense;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain.GetBankAutoTransferExpenseCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.GetBankAutoTransferExpensePortOut;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class GetBankAutoTransferExpenseDao implements GetBankAutoTransferExpensePortOut {
|
||||||
|
private final GetBankAutoTransferExpenseMapper mapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<GetBankAutoTransferExpense> operate(GetBankAutoTransferExpenseCmd cmd) {
|
||||||
|
return mapper.getBankAutoTransferExpense(cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain.GetBankAutoTransferExpense;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain.GetBankAutoTransferExpenseCmd;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface GetBankAutoTransferExpenseMapper {
|
||||||
|
Optional<GetBankAutoTransferExpense> getBankAutoTransferExpense(
|
||||||
|
GetBankAutoTransferExpenseCmd cmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.GetBankAutoTransferExpensePortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain.GetBankAutoTransferExpenseCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.adapters.web.model.GetBankAutoTransferExpenseReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.adapters.web.model.GetBankAutoTransferExpenseResVO;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class GetBankAutoTransferExpenseController {
|
||||||
|
private final GetBankAutoTransferExpensePortIn portIn;
|
||||||
|
|
||||||
|
@GetMapping(path = "/api/household/bankAutoTransferExpense/{id}")
|
||||||
|
ResponseEntity<?> operate(@PathVariable Long id) {
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(
|
||||||
|
portIn.operate(new GetBankAutoTransferExpenseCmd(id)).orElse(null));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetBankAutoTransferExpenseReqVO {
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetBankAutoTransferExpenseResVO {
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain.GetBankAutoTransferExpense;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain.GetBankAutoTransferExpenseCmd;
|
||||||
|
|
||||||
|
public interface GetBankAutoTransferExpensePortIn {
|
||||||
|
Optional<GetBankAutoTransferExpense> operate(GetBankAutoTransferExpenseCmd cmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain.GetBankAutoTransferExpense;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain.GetBankAutoTransferExpenseCmd;
|
||||||
|
|
||||||
|
public interface GetBankAutoTransferExpensePortOut {
|
||||||
|
Optional<GetBankAutoTransferExpense> operate(GetBankAutoTransferExpenseCmd cmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain.GetBankAutoTransferExpense;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain.GetBankAutoTransferExpenseCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.GetBankAutoTransferExpensePortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.GetBankAutoTransferExpensePortOut;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class GetBankAutoTransferExpenseService implements GetBankAutoTransferExpensePortIn {
|
||||||
|
private final GetBankAutoTransferExpensePortOut portOut;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<GetBankAutoTransferExpense> operate(GetBankAutoTransferExpenseCmd cmd) {
|
||||||
|
return portOut.operate(cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetBankAutoTransferExpense {
|
||||||
|
private Long id;
|
||||||
|
private Long householdSeq;
|
||||||
|
private String expenseCode;
|
||||||
|
private String transferCategoryCode;
|
||||||
|
private String transferCategory;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private String count;
|
||||||
|
private String unitCode;
|
||||||
|
private String unit;
|
||||||
|
private Long price;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetBankAutoTransferExpenseCmd {
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ public class GetBankAutoTransferIncome {
|
|||||||
private String expenseCode;
|
private String expenseCode;
|
||||||
private String transferCategoryCode;
|
private String transferCategoryCode;
|
||||||
private String transferCategory;
|
private String transferCategory;
|
||||||
|
private String sourcePurpose;
|
||||||
private String count;
|
private String count;
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
private String unit;
|
private String unit;
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.config.application.enums.MonthlyInputStatusType;
|
||||||
|
import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence.UpdateMonthlyInputStatusMapper;
|
||||||
|
import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.UpdateForestProductStatusCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.application.domain.RemoveBankAutoTransfersOutCmd;
|
||||||
|
import app.module.core.config.application.annotation.DeleteCommand;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.application.domain.RemoveBankAutoTransfersInCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.RemoveBankAutoTransfersPortOut;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class RemoveBankAutoTransfersDao implements RemoveBankAutoTransfersPortOut {
|
||||||
|
private final RemoveBankAutoTransfersMapper removeBankAutoTransfersMapper;
|
||||||
|
private final UpdateMonthlyInputStatusMapper updateMonthlyInputStatusMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DeleteCommand
|
||||||
|
@Transactional
|
||||||
|
public void operate(RemoveBankAutoTransfersOutCmd outCmd) {
|
||||||
|
// 삭제
|
||||||
|
removeBankAutoTransfersMapper.remove(outCmd);
|
||||||
|
|
||||||
|
if (!removeBankAutoTransfersMapper.existsBankAutoTransfer(outCmd.getMonthlyInputStatusId())) {
|
||||||
|
// 수입내역 모두 삭제되었을 경우 입력상태 미등록으로 update
|
||||||
|
if (outCmd.getRemoveType().equals("INCOME")) {
|
||||||
|
updateMonthlyInputStatusMapper.updateBankInputStatus(
|
||||||
|
new UpdateForestProductStatusCmd(outCmd.getMonthlyInputStatusId(),
|
||||||
|
MonthlyInputStatusType.NONE.name()));
|
||||||
|
} else {
|
||||||
|
// 지출내역 모두 삭제되었을 경우 입력상태 미등록으로 update
|
||||||
|
updateMonthlyInputStatusMapper.updateBankOutputStatus(
|
||||||
|
new UpdateForestProductStatusCmd(outCmd.getMonthlyInputStatusId(),
|
||||||
|
MonthlyInputStatusType.NONE.name()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.application.domain.RemoveBankAutoTransfersInCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.application.domain.RemoveBankAutoTransfersOutCmd;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface RemoveBankAutoTransfersMapper {
|
||||||
|
void remove(RemoveBankAutoTransfersOutCmd cmd);
|
||||||
|
boolean existsBankAutoTransfer(Long monthlyInputStatusId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.RemoveBankAutoTransfersPortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.application.domain.RemoveBankAutoTransfersInCmd;
|
||||||
|
import app.module.core.config.application.util.MessageUtil;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.adapters.web.model.RemoveBankAutoTransfersReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.adapters.web.model.RemoveBankAutoTransfersResVO;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class RemoveBankAutoTransfersController {
|
||||||
|
private final RemoveBankAutoTransfersPortIn portIn;
|
||||||
|
private final MessageUtil messageUtil;
|
||||||
|
|
||||||
|
@DeleteMapping(path = "/api/household/bank/delete")
|
||||||
|
ResponseEntity<?> operate(@Valid @RequestBody RemoveBankAutoTransfersReqVO reqVO,
|
||||||
|
BindingResult bindingResult) {
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(bindingResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
portIn.operate(
|
||||||
|
new RemoveBankAutoTransfersInCmd(
|
||||||
|
reqVO.getHouseholdSeq(),
|
||||||
|
reqVO.getRecordMonth(),
|
||||||
|
reqVO.getRemoveType(),
|
||||||
|
reqVO.getRemoveIds()));
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new RemoveBankAutoTransfersResVO(
|
||||||
|
messageUtil.getMessage("operation.common.remove.done")));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.adapters.web.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class RemoveBankAutoTransfersReqVO {
|
||||||
|
private Long householdSeq;
|
||||||
|
private String recordMonth;
|
||||||
|
private String removeType;
|
||||||
|
private List<Long> removeIds;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class RemoveBankAutoTransfersResVO {
|
||||||
|
private String message;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.application.domain.RemoveBankAutoTransfersInCmd;
|
||||||
|
|
||||||
|
public interface RemoveBankAutoTransfersPortIn {
|
||||||
|
void operate(RemoveBankAutoTransfersInCmd inCmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.application.domain.RemoveBankAutoTransfersOutCmd;
|
||||||
|
|
||||||
|
public interface RemoveBankAutoTransfersPortOut {
|
||||||
|
void operate(RemoveBankAutoTransfersOutCmd outCmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.application;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortIn;
|
||||||
|
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||||
|
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.application.domain.RemoveBankAutoTransfersOutCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.application.domain.RemoveBankAutoTransfersInCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.RemoveBankAutoTransfersPortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.RemoveBankAutoTransfersPortOut;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class RemoveBankAutoTransfersService implements RemoveBankAutoTransfersPortIn {
|
||||||
|
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
||||||
|
private final RemoveBankAutoTransfersPortOut portOut;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operate(RemoveBankAutoTransfersInCmd inCmd) {
|
||||||
|
GetMonthlyInputStatus monthlyInputStatus =
|
||||||
|
getMonthlyInputStatusPortIn
|
||||||
|
.operate(new GetMonthlyInputStatusCmd(inCmd.getHouseholdSeq(), inCmd.getRecordMonth()))
|
||||||
|
.orElseThrow(() -> new IllegalStateException("입력 상태 정보가 존재하지 않습니다."));
|
||||||
|
|
||||||
|
portOut.operate(new RemoveBankAutoTransfersOutCmd(
|
||||||
|
monthlyInputStatus.getId(),
|
||||||
|
inCmd.getRemoveType(),
|
||||||
|
inCmd.getRemoveIds()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.application.domain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RemoveBankAutoTransfersInCmd {
|
||||||
|
private Long householdSeq;
|
||||||
|
private String recordMonth;
|
||||||
|
private String removeType;
|
||||||
|
private List<Long> removeIds;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RemoveBankAutoTransfersOutCmd extends AuditCommand {
|
||||||
|
private Long monthlyInputStatusId;
|
||||||
|
private String removeType;
|
||||||
|
private List<Long> removeIds;
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.config.application.enums.MonthlyInputStatusType;
|
||||||
|
import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence.UpdateMonthlyInputStatusMapper;
|
||||||
|
import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.UpdateForestProductStatusCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.SaveBankAutoTransferExpensePortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain.SaveBankAutoTransferExpenseOutCmd;
|
||||||
|
import app.module.core.config.application.util.AuditUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class SaveBankAutoTransferExpenseDao implements SaveBankAutoTransferExpensePortOut {
|
||||||
|
|
||||||
|
private final SaveBankAutoTransferExpenseMapper saveBankAutoTransferExpenseMapper;
|
||||||
|
private final UpdateMonthlyInputStatusMapper updateMonthlyInputStatusMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void operate(SaveBankAutoTransferExpenseOutCmd outCmd) {
|
||||||
|
if (outCmd.getBankAutoTransferId() == null) {
|
||||||
|
// 등록 상태가 "REGISTERED"가 아닐 경우 "REGISTERED"로 update
|
||||||
|
if (!MonthlyInputStatusType.REGISTERED.name().equals(
|
||||||
|
outCmd.getBankAutoTransferOutputStatus())) {
|
||||||
|
updateMonthlyInputStatusMapper.updateBankOutputStatus(
|
||||||
|
new UpdateForestProductStatusCmd(
|
||||||
|
outCmd.getMonthlyInputStatusId(),
|
||||||
|
MonthlyInputStatusType.REGISTERED.name()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 은행자동이체(지출) 등록
|
||||||
|
saveBankAutoTransferExpenseMapper.createBankAutoTransferExpense(
|
||||||
|
AuditUtil.create(outCmd));
|
||||||
|
} else {
|
||||||
|
// 은행자동이체(지출) update
|
||||||
|
saveBankAutoTransferExpenseMapper.updateBankAutoTransferExpense(
|
||||||
|
AuditUtil.update(outCmd));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain.SaveBankAutoTransferExpenseOutCmd;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SaveBankAutoTransferExpenseMapper {
|
||||||
|
void createBankAutoTransferExpense(SaveBankAutoTransferExpenseOutCmd cmd);
|
||||||
|
void updateBankAutoTransferExpense(SaveBankAutoTransferExpenseOutCmd cmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.SaveBankAutoTransferExpensePortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain.SaveBankAutoTransferExpenseInCmd;
|
||||||
|
import app.module.core.config.application.util.MessageUtil;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.web.model.SaveBankAutoTransferExpenseReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.web.model.SaveBankAutoTransferExpenseResVO;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.web.validator.SaveBankAutoTransferExpenseValidator;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class SaveBankAutoTransferExpenseController {
|
||||||
|
private final SaveBankAutoTransferExpenseValidator validator;
|
||||||
|
private final SaveBankAutoTransferExpensePortIn portIn;
|
||||||
|
private final MessageUtil messageUtil;
|
||||||
|
|
||||||
|
@PostMapping(path = "/api/household/bank/expense/save")
|
||||||
|
ResponseEntity<?> operate(@Valid @RequestBody SaveBankAutoTransferExpenseReqVO reqVO,
|
||||||
|
BindingResult bindingResult) {
|
||||||
|
validator.validate(reqVO, bindingResult);
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||||
|
.body(bindingResult.getFieldErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
portIn.operate(
|
||||||
|
new SaveBankAutoTransferExpenseInCmd(
|
||||||
|
reqVO.getBankAutoTransferId(),
|
||||||
|
reqVO.getHouseholdSeq(),
|
||||||
|
reqVO.getRecordMonth(),
|
||||||
|
reqVO.getExpenseCode(),
|
||||||
|
reqVO.getTransferCategoryCode(),
|
||||||
|
reqVO.getTransferCategory(),
|
||||||
|
reqVO.getSourcePurpose(),
|
||||||
|
reqVO.getCount(),
|
||||||
|
reqVO.getUnitCode(),
|
||||||
|
reqVO.getUnit(),
|
||||||
|
reqVO.getPrice()));
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new SaveBankAutoTransferExpenseResVO(
|
||||||
|
messageUtil.getMessage("operation.common.save.done")));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class SaveBankAutoTransferExpenseReqVO {
|
||||||
|
private Long bankAutoTransferId;
|
||||||
|
private Long householdSeq;
|
||||||
|
private String recordMonth;
|
||||||
|
private String expenseCode;
|
||||||
|
private String transferCategoryCode;
|
||||||
|
private String transferCategory;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private String count;
|
||||||
|
private String unitCode;
|
||||||
|
private String unit;
|
||||||
|
private Long price;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class SaveBankAutoTransferExpenseResVO {
|
||||||
|
private String message;
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.web.validator;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.web.model.SaveBankAutoTransferExpenseReqVO;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.validation.Errors;
|
||||||
|
import org.springframework.validation.Validator;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class SaveBankAutoTransferExpenseValidator implements Validator {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supports(Class<?> clazz) {
|
||||||
|
return SaveBankAutoTransferExpenseReqVO.class.equals(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate(Object target, Errors errors) {
|
||||||
|
SaveBankAutoTransferExpenseReqVO vo = (SaveBankAutoTransferExpenseReqVO) target;
|
||||||
|
|
||||||
|
// 지출의 종류 null 체크
|
||||||
|
if (!StringUtils.hasText(vo.getTransferCategoryCode())) {
|
||||||
|
errors.rejectValue("transferCategoryCode", "error.transferCategoryCode",
|
||||||
|
"지출의 종류를 선택해주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 지출의 종류 직접입력일 때 unll 체크
|
||||||
|
if (vo.getTransferCategoryCode().equals("code.bank.output.self") && !StringUtils.hasText(
|
||||||
|
vo.getTransferCategory())) {
|
||||||
|
errors.rejectValue("transferCategory", "error.transferCategory",
|
||||||
|
"지출의 종류를 입력해주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 수량 입력 O, 단위 선택 X
|
||||||
|
if (StringUtils.hasText(vo.getCount()) && !StringUtils.hasText(vo.getUnitCode())) {
|
||||||
|
errors.rejectValue("unitCode", "error.unitCode",
|
||||||
|
"단위를 선택해주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 수량 입력 X, 단위 선택 O
|
||||||
|
if (StringUtils.hasText(vo.getUnitCode()) && !StringUtils.hasText(vo.getCount())) {
|
||||||
|
errors.rejectValue("count", "error.count",
|
||||||
|
"수량을 입력해주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 단위 직접입력 선택 후 직접입력 input null 일 경우
|
||||||
|
if (vo.getUnitCode().equals("code.count.unit.self") && !StringUtils.hasText(vo.getUnit())) {
|
||||||
|
errors.rejectValue("unit", "error.unit",
|
||||||
|
"직접입력 단위를 입력해주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 현금
|
||||||
|
if (vo.getPrice() == null) {
|
||||||
|
errors.rejectValue("price", "error.price",
|
||||||
|
"현금(원)을 입력해주세요.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain.SaveBankAutoTransferExpenseInCmd;
|
||||||
|
|
||||||
|
public interface SaveBankAutoTransferExpensePortIn {
|
||||||
|
void operate(SaveBankAutoTransferExpenseInCmd inCmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain.SaveBankAutoTransferExpenseOutCmd;
|
||||||
|
|
||||||
|
public interface SaveBankAutoTransferExpensePortOut {
|
||||||
|
void operate(SaveBankAutoTransferExpenseOutCmd outCmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortIn;
|
||||||
|
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||||
|
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.SaveBankAutoTransferExpensePortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.SaveBankAutoTransferExpensePortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain.SaveBankAutoTransferExpenseInCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain.SaveBankAutoTransferExpenseOutCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class SaveBankAutoTransferExpenseService implements SaveBankAutoTransferExpensePortIn {
|
||||||
|
|
||||||
|
private final SaveBankAutoTransferExpensePortOut portOut;
|
||||||
|
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operate(SaveBankAutoTransferExpenseInCmd inCmd) {
|
||||||
|
|
||||||
|
// 월별 등록상태 조회
|
||||||
|
GetMonthlyInputStatus monthlyInputStatus = getMonthlyInputStatusPortIn
|
||||||
|
.operate(new GetMonthlyInputStatusCmd(inCmd.getHouseholdSeq(), inCmd.getRecordMonth()))
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
portOut.operate(new SaveBankAutoTransferExpenseOutCmd(
|
||||||
|
inCmd.getBankAutoTransferId(),
|
||||||
|
inCmd.getHouseholdSeq(),
|
||||||
|
inCmd.getRecordMonth(),
|
||||||
|
inCmd.getExpenseCode(),
|
||||||
|
inCmd.getTransferCategoryCode(),
|
||||||
|
inCmd.getTransferCategory(),
|
||||||
|
inCmd.getSourcePurpose(),
|
||||||
|
inCmd.getCount(),
|
||||||
|
inCmd.getUnitCode(),
|
||||||
|
inCmd.getUnit(),
|
||||||
|
inCmd.getPrice(),
|
||||||
|
"code.bank.output", // 지출 type code
|
||||||
|
"2", // 지출 유형 2 고정
|
||||||
|
monthlyInputStatus.getId(),
|
||||||
|
monthlyInputStatus.getBankAutoTransferOutputStatus()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class SaveBankAutoTransferExpenseInCmd {
|
||||||
|
private Long bankAutoTransferId;
|
||||||
|
private Long householdSeq;
|
||||||
|
private String recordMonth;
|
||||||
|
private String expenseCode;
|
||||||
|
private String transferCategoryCode;
|
||||||
|
private String transferCategory;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private String count;
|
||||||
|
private String unitCode;
|
||||||
|
private String unit;
|
||||||
|
private Long price;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SaveBankAutoTransferExpenseOutCmd extends AuditCommand {
|
||||||
|
private Long bankAutoTransferId;
|
||||||
|
private Long householdSeq;
|
||||||
|
private String recordMonth;
|
||||||
|
private String expenseCode;
|
||||||
|
private String transferCategoryCode;
|
||||||
|
private String transferCategory;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private String count;
|
||||||
|
private String unitCode;
|
||||||
|
private String unit;
|
||||||
|
private Long price;
|
||||||
|
private String transferType;
|
||||||
|
private String category;
|
||||||
|
private Long monthlyInputStatusId;
|
||||||
|
private String bankAutoTransferOutputStatus;
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.web;
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports.SaveBankAutoTransferIncomePortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports.application.domain.SaveBankAutoTransferIncomeInCmd;
|
||||||
import app.module.core.config.application.util.MessageUtil;
|
import app.module.core.config.application.util.MessageUtil;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -16,19 +18,36 @@ import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTrans
|
|||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class SaveBankAutoTransferIncomeController {
|
class SaveBankAutoTransferIncomeController {
|
||||||
private final SaveBankAutoTransferIncomeValidator validator;
|
private final SaveBankAutoTransferIncomeValidator validator;
|
||||||
private final MessageUtil messageUtil;
|
private final SaveBankAutoTransferIncomePortIn portIn;
|
||||||
|
private final MessageUtil messageUtil;
|
||||||
|
|
||||||
@PostMapping(path = "/api/household/bank/income/save")
|
@PostMapping(path = "/api/household/bank/income/save")
|
||||||
ResponseEntity<?> operate(
|
ResponseEntity<?> operate(@Valid @RequestBody SaveBankAutoTransferIncomeReqVO reqVO,
|
||||||
@Valid @RequestBody SaveBankAutoTransferIncomeReqVO reqVO, BindingResult bindingResult) {
|
BindingResult bindingResult) {
|
||||||
validator.validate(reqVO, bindingResult);
|
validator.validate(reqVO, bindingResult);
|
||||||
if (bindingResult.hasErrors()) {
|
if (bindingResult.hasErrors()) {
|
||||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||||
.body(bindingResult.getFieldErrors());
|
.body(bindingResult.getFieldErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
portIn.operate(
|
||||||
|
new SaveBankAutoTransferIncomeInCmd(
|
||||||
|
reqVO.getBankAutoTransferId(),
|
||||||
|
reqVO.getHouseholdSeq(),
|
||||||
|
reqVO.getRecordMonth(),
|
||||||
|
reqVO.getCropCode(),
|
||||||
|
reqVO.getIncomeCode(),
|
||||||
|
reqVO.getExpenseCode(),
|
||||||
|
reqVO.getTransferCategoryCode(),
|
||||||
|
reqVO.getTransferCategory(),
|
||||||
|
reqVO.getSourcePurpose(),
|
||||||
|
reqVO.getCount(),
|
||||||
|
reqVO.getUnitCode(),
|
||||||
|
reqVO.getUnit(),
|
||||||
|
reqVO.getPrice()));
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new SaveBankAutoTransferIncomeResVO(
|
||||||
|
messageUtil.getMessage("operation.common.save.done")));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
|
||||||
.body(new SaveBankAutoTransferIncomeResVO(messageUtil.getMessage("operation.common.save.done")));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -22,5 +22,5 @@ public class SaveBankAutoTransferIncomeReqVO {
|
|||||||
private String count;
|
private String count;
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
private String unit;
|
private String unit;
|
||||||
private String price;
|
private Long price;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,32 +9,64 @@ import org.springframework.validation.Validator;
|
|||||||
@Component
|
@Component
|
||||||
public class SaveBankAutoTransferIncomeValidator implements Validator {
|
public class SaveBankAutoTransferIncomeValidator implements Validator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supports(Class<?> clazz) {
|
public boolean supports(Class<?> clazz) {
|
||||||
return SaveBankAutoTransferIncomeReqVO.class.equals(clazz);
|
return SaveBankAutoTransferIncomeReqVO.class.equals(clazz);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate(Object target, Errors errors) {
|
|
||||||
SaveBankAutoTransferIncomeReqVO vo = (SaveBankAutoTransferIncomeReqVO) target;
|
|
||||||
|
|
||||||
if(!StringUtils.hasText(vo.getTransferCategoryCode())) {
|
|
||||||
errors.rejectValue("transferCategoryCode", "error.transferCategoryCode", "수입의 종류를 선택해주세요.");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 수입의 종류가 특정 코드가 아닐 때만 대상 체크
|
@Override
|
||||||
if (!vo.getTransferCategoryCode().equals("code.bank.input.10") &&
|
public void validate(Object target, Errors errors) {
|
||||||
!vo.getTransferCategoryCode().equals("code.bank.input.12") &&
|
SaveBankAutoTransferIncomeReqVO vo = (SaveBankAutoTransferIncomeReqVO) target;
|
||||||
!vo.getTransferCategoryCode().equals("code.bank.input.13") &&
|
|
||||||
!StringUtils.hasText(vo.getTransferCategory())) {
|
|
||||||
errors.rejectValue("transferCategory", "error.transferCategory", "대상을 입력해주세요.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 현금
|
// 수입의 종류 null 체크
|
||||||
if(!StringUtils.hasText(vo.getPrice())) {
|
if (!StringUtils.hasText(vo.getTransferCategoryCode())) {
|
||||||
errors.rejectValue("price", "error.price", "현금(원)을 입력해주세요.");
|
errors.rejectValue("transferCategoryCode", "error.transferCategoryCode",
|
||||||
|
"수입의 종류를 선택해주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 수입의 종류가 특정 코드가 아닐 때만 대상 체크
|
||||||
|
if (!vo.getTransferCategoryCode().equals("code.bank.input.10")
|
||||||
|
&& !vo.getTransferCategoryCode().equals("code.bank.input.12")
|
||||||
|
&& !vo.getTransferCategoryCode().equals("code.bank.input.13")
|
||||||
|
&& !StringUtils.hasText(vo.getTransferCategory())) {
|
||||||
|
errors.rejectValue("transferCategory", "error.transferCategory",
|
||||||
|
"대상을 입력해주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 수입의 종류 직접입력일 때 unll 체크
|
||||||
|
if(vo.getTransferCategoryCode().equals("code.bank.input.self")
|
||||||
|
&& !StringUtils.hasText(vo.getTransferCategory())) {
|
||||||
|
errors.rejectValue("transferCategory", "error.transferCategory",
|
||||||
|
"수입의 종류를 입력해주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 수량 입력 O, 단위 선택 X
|
||||||
|
if (StringUtils.hasText(vo.getCount()) && !StringUtils.hasText(vo.getUnitCode())) {
|
||||||
|
errors.rejectValue("unitCode", "error.unitCode",
|
||||||
|
"단위를 선택해주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 수량 입력 X, 단위 선택 O
|
||||||
|
if (StringUtils.hasText(vo.getUnitCode()) && !StringUtils.hasText(vo.getCount())) {
|
||||||
|
errors.rejectValue("count", "error.count",
|
||||||
|
"수량을 입력해주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 단위 직접입력 선택 후 직접입력 input null 일 경우
|
||||||
|
if (vo.getUnitCode().equals("code.count.unit.self") && !StringUtils.hasText(vo.getUnit())) {
|
||||||
|
errors.rejectValue("unit", "error.unit",
|
||||||
|
"직접입력 단위를 입력해주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 현금
|
||||||
|
if (vo.getPrice() == null) {
|
||||||
|
errors.rejectValue("price", "error.price",
|
||||||
|
"현금(원)을 입력해주세요.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ class SaveBankAutoTransferIncomeService implements SaveBankAutoTransferIncomePor
|
|||||||
inCmd.getUnit(),
|
inCmd.getUnit(),
|
||||||
inCmd.getPrice(),
|
inCmd.getPrice(),
|
||||||
"code.bank.input", // 수입 type code
|
"code.bank.input", // 수입 type code
|
||||||
"1", // 수입 유형 1
|
"1", // 수입 유형 1 고정
|
||||||
monthlyInputStatus.getId(),
|
monthlyInputStatus.getId(),
|
||||||
monthlyInputStatus.getBankAutoTransferInputStatus()
|
monthlyInputStatus.getBankAutoTransferInputStatus()
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -22,5 +22,5 @@ public class SaveBankAutoTransferIncomeInCmd {
|
|||||||
private String count;
|
private String count;
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
private String unit;
|
private String unit;
|
||||||
private String price;
|
private Long price;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class SaveBankAutoTransferIncomeOutCmd extends AuditCommand {
|
|||||||
private String count;
|
private String count;
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
private String unit;
|
private String unit;
|
||||||
private String price;
|
private Long price;
|
||||||
private String transferType;
|
private String transferType;
|
||||||
private String category;
|
private String category;
|
||||||
private Long monthlyInputStatusId;
|
private Long monthlyInputStatusId;
|
||||||
|
|||||||
@@ -13,21 +13,21 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Repository
|
@Repository
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class RemoveForestProductsDao implements RemoveForestProductsPortOut {
|
class RemoveForestProductsDao implements RemoveForestProductsPortOut {
|
||||||
private final RemoveForestProductsMapper removeForestProductsMapper;
|
private final RemoveForestProductsMapper removeForestProductsMapper;
|
||||||
private final UpdateMonthlyInputStatusMapper updateMonthlyInputStatusMapper;
|
private final UpdateMonthlyInputStatusMapper updateMonthlyInputStatusMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DeleteCommand
|
@DeleteCommand
|
||||||
@Transactional
|
@Transactional
|
||||||
public void operate(RemoveForestProductsCmd cmd) {
|
public void operate(RemoveForestProductsCmd cmd) {
|
||||||
// 임산물 현황 삭제
|
// 임산물 현황 삭제
|
||||||
removeForestProductsMapper.removeForestProducts(cmd);
|
removeForestProductsMapper.remove(cmd);
|
||||||
|
|
||||||
// 임산물 모두 삭제됐을 경우 입력상태 미등록으로 update
|
// 임산물 모두 삭제됐을 경우 입력상태 미등록으로 update
|
||||||
if (!removeForestProductsMapper.existsForestProduct(cmd.getMonthlyInputStatusId())) {
|
if (!removeForestProductsMapper.existsForestProduct(cmd.getMonthlyInputStatusId())) {
|
||||||
updateMonthlyInputStatusMapper.updateForestProductStatus(
|
updateMonthlyInputStatusMapper.updateForestProductStatus(
|
||||||
new UpdateForestProductStatusCmd(cmd.getMonthlyInputStatusId(),
|
new UpdateForestProductStatusCmd(cmd.getMonthlyInputStatusId(),
|
||||||
MonthlyInputStatusType.NONE.name()));
|
MonthlyInputStatusType.NONE.name()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface RemoveForestProductsMapper {
|
public interface RemoveForestProductsMapper {
|
||||||
void removeForestProducts(RemoveForestProductsCmd cmd);
|
void remove(RemoveForestProductsCmd cmd);
|
||||||
boolean existsForestProduct(Long monthlyInputStatusId);
|
boolean existsForestProduct(Long monthlyInputStatusId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper
|
||||||
|
namespace="app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.adapters.persistence.GetBankAutoTransferExpenseMapper">
|
||||||
|
<select id="getBankAutoTransferExpense"
|
||||||
|
resultType="app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferExpense.ports.application.domain.GetBankAutoTransferExpense">
|
||||||
|
/* getBankAutoTransferExpense : 은행자동이체(지출) 상세 조회 */
|
||||||
|
SELECT id,
|
||||||
|
household_seq,
|
||||||
|
expense_code,
|
||||||
|
transfer_category_code,
|
||||||
|
transfer_category,
|
||||||
|
source_purpose,
|
||||||
|
count,
|
||||||
|
unit_code,
|
||||||
|
unit,
|
||||||
|
price
|
||||||
|
FROM bank_auto_transfer
|
||||||
|
WHERE is_deleted = false
|
||||||
|
AND id = #{id}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper
|
||||||
|
namespace="app.module.admin.usecase.household.tab.bankAutoTransfer.removeBankAutoTranfers.adapters.persistence.RemoveBankAutoTransfersMapper">
|
||||||
|
<update id="remove">
|
||||||
|
/* remove : 은행자동이체내역 삭제*/
|
||||||
|
UPDATE bank_auto_transfer
|
||||||
|
SET <include refid="common.fields.DeleteBaseSet"/>
|
||||||
|
WHERE id IN
|
||||||
|
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="existsBankAutoTransfer" resultType="boolean">
|
||||||
|
/* existsBankAutoTransfer : 은행자동이체내역 존재 여부 */
|
||||||
|
SELECT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM bank_auto_transfer
|
||||||
|
WHERE is_deleted = false
|
||||||
|
AND monthly_input_status_id = #{monthlyInputStatusId}
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper
|
<mapper
|
||||||
namespace="app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.adapters.persistence.RemoveForestProductsMapper">
|
namespace="app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.adapters.persistence.RemoveForestProductsMapper">
|
||||||
<update id="removeForestProducts">
|
<update id="remove">
|
||||||
/* removeForestProducts : 임산물현황 삭제*/
|
/* remove : 임산물현황 삭제*/
|
||||||
UPDATE forest_product
|
UPDATE forest_product
|
||||||
SET <include refid="common.fields.DeleteBaseSet"/>
|
SET <include refid="common.fields.DeleteBaseSet"/>
|
||||||
WHERE id IN
|
WHERE id IN
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper
|
||||||
|
namespace="app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.persistence.SaveBankAutoTransferExpenseMapper">
|
||||||
|
<insert id="createBankAutoTransferExpense">
|
||||||
|
/* createBankAutoTransferExpense : 은행자동이체(지출) 등록 */
|
||||||
|
INSERT INTO bank_auto_transfer
|
||||||
|
(
|
||||||
|
household_seq,
|
||||||
|
month,
|
||||||
|
expense_code,
|
||||||
|
transfer_category_code,
|
||||||
|
transfer_category,
|
||||||
|
source_purpose,
|
||||||
|
count,
|
||||||
|
unit_code,
|
||||||
|
unit,
|
||||||
|
price,
|
||||||
|
transfer_type,
|
||||||
|
monthly_input_status_id,
|
||||||
|
category,
|
||||||
|
<include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
#{householdSeq},
|
||||||
|
#{recordMonth},
|
||||||
|
#{expenseCode},
|
||||||
|
#{transferCategoryCode},
|
||||||
|
#{transferCategory},
|
||||||
|
#{sourcePurpose},
|
||||||
|
#{count},
|
||||||
|
#{unitCode},
|
||||||
|
#{unit},
|
||||||
|
#{price},
|
||||||
|
#{transferType},
|
||||||
|
#{monthlyInputStatusId},
|
||||||
|
#{category},
|
||||||
|
<include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateBankAutoTransferExpense">
|
||||||
|
/* updateBankAutoTransferExpense : 은행자동이체(지출) 수정 */
|
||||||
|
UPDATE bank_auto_transfer
|
||||||
|
SET
|
||||||
|
household_seq = #{householdSeq},
|
||||||
|
expense_code = #{expenseCode},
|
||||||
|
transfer_category_code = #{transferCategoryCode},
|
||||||
|
transfer_category = #{transferCategory},
|
||||||
|
source_purpose = #{sourcePurpose},
|
||||||
|
count = #{count},
|
||||||
|
unit_code = #{unitCode},
|
||||||
|
unit = #{unit},
|
||||||
|
price = #{price},
|
||||||
|
<include refid="common.fields.UpdateBaseSet"/>
|
||||||
|
WHERE id = #{bankAutoTransferId}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
#{sourcePurpose},
|
#{sourcePurpose},
|
||||||
#{count},
|
#{count},
|
||||||
#{unitCode},
|
#{unitCode},
|
||||||
|
#{unit},
|
||||||
#{price},
|
#{price},
|
||||||
#{transferType},
|
#{transferType},
|
||||||
#{monthlyInputStatusId},
|
#{monthlyInputStatusId},
|
||||||
@@ -57,6 +58,7 @@
|
|||||||
source_purpose = #{sourcePurpose},
|
source_purpose = #{sourcePurpose},
|
||||||
count = #{count},
|
count = #{count},
|
||||||
unit_code = #{unitCode},
|
unit_code = #{unitCode},
|
||||||
|
unit = #{unit},
|
||||||
price = #{price},
|
price = #{price},
|
||||||
<include refid="common.fields.UpdateBaseSet"/>
|
<include refid="common.fields.UpdateBaseSet"/>
|
||||||
WHERE id = #{bankAutoTransferId}
|
WHERE id = #{bankAutoTransferId}
|
||||||
|
|||||||
@@ -3,21 +3,30 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper
|
<mapper
|
||||||
namespace="app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence.UpdateMonthlyInputStatusMapper">
|
namespace="app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence.UpdateMonthlyInputStatusMapper">
|
||||||
<update id="updateForestProductStatus">
|
<update id="updateForestProductStatus">
|
||||||
/* updateForestProductStatus : 임산물현황 입력상태 수정 */
|
/* updateForestProductStatus : 임산물현황 입력상태 수정 */
|
||||||
UPDATE monthly_input_status
|
UPDATE monthly_input_status
|
||||||
SET forest_product_status = #{status},
|
SET forest_product_status = #{status},
|
||||||
<include refid="common.fields.UpdateBaseSet"/>
|
<include refid="common.fields.UpdateBaseSet"/>
|
||||||
WHERE is_deleted = false
|
WHERE is_deleted = false
|
||||||
AND id = #{id}
|
AND id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateBankInputStatus">
|
<update id="updateBankInputStatus">
|
||||||
/* updateBankInputStatus : 은행자동이체(수입) 입력상태 수정 */
|
/* updateBankInputStatus : 은행자동이체(수입) 입력상태 수정 */
|
||||||
UPDATE monthly_input_status
|
UPDATE monthly_input_status
|
||||||
SET bank_auto_transfer_input_status = #{status},
|
SET bank_auto_transfer_input_status = #{status},
|
||||||
<include refid="common.fields.UpdateBaseSet"/>
|
<include refid="common.fields.UpdateBaseSet"/>
|
||||||
WHERE is_deleted = false
|
WHERE is_deleted = false
|
||||||
AND id = #{id}
|
AND id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateBankOutputStatus">
|
||||||
|
/* updateBankOutputStatus : 은행자동이체(지출) 입력상태 수정 */
|
||||||
|
UPDATE monthly_input_status
|
||||||
|
SET bank_auto_transfer_output_status = #{status},
|
||||||
|
<include refid="common.fields.UpdateBaseSet"/>
|
||||||
|
WHERE is_deleted = false
|
||||||
|
AND id = #{id}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -0,0 +1,273 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||||
|
layout:decorate="~{layout/layout}">
|
||||||
|
|
||||||
|
<div class="layer-wrap" th:fragment="modalFragment">
|
||||||
|
<!-- 은행자동이체(지출) 등록 모달 폼 -->
|
||||||
|
<form autocomplete="off" method="get" name="reqBankExpenseForm">
|
||||||
|
<input type="hidden" name="bankAutoTransferId">
|
||||||
|
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||||
|
<input type="hidden" name="recordMonth">
|
||||||
|
<input type="hidden" name="expenseCode">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="component-modal mypage-wrap modal01 modal-bank-expense" data-props-dimm-click="true" data-state="close">
|
||||||
|
<div class="modal-dimm"></div>
|
||||||
|
<div class="modal-frame">
|
||||||
|
<div class="modal-container">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-tit">
|
||||||
|
은행자동이체(지출)
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-content-inner">
|
||||||
|
<!-- <i class="ico-required-mark" role="img" aria-label="필수">*</i><p>필수입력</p>-->
|
||||||
|
<table class="type-form confirm">
|
||||||
|
<colgroup>
|
||||||
|
<col width="10%" />
|
||||||
|
<col width="40%" />
|
||||||
|
<col width="10%" />
|
||||||
|
<col width="40%" />
|
||||||
|
</colgroup>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>지출의 종류<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="transferCategoryCode" onchange="selectedExpenseCategory(this);" required>
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="item : ${bankOutputCodes}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeText}"
|
||||||
|
th:data-code-value="${item.codeValue}"
|
||||||
|
th:data-code-type="${item.codeType}">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<!-- 직접입력 항목 -->
|
||||||
|
<div class="component-input self-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" class="transfer-category-self" name="transferCategory" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<th>용도</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="sourcePurpose" name="sourcePurpose" maxlength="30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>수량</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" id="count" name="count"
|
||||||
|
maxlength="10" inputmode="decimal" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<th>단위</th>
|
||||||
|
<td>
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="unitCode" onchange="selectedSelf(this);" required>
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="item : ${countUnitCodes}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeText}">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<!-- 직접입력 수량 단위 -->
|
||||||
|
<div class="component-input self-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="unit" name="unit" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>현금(원)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td >
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" id="price" name="price"
|
||||||
|
maxlength="30" inputmode="numeric" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="component-btns bottom-btn-group">
|
||||||
|
<div class="btns-row align-right">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="saveBankExpense();">
|
||||||
|
<span class="btn-txt">등록</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="modal-close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// 은행자동이체(수입) 모달창 띄우기
|
||||||
|
const showBankExpenseModal = (id) => {
|
||||||
|
const f = document.reqBankExpenseForm;
|
||||||
|
const reqForm = document.reqForm;
|
||||||
|
|
||||||
|
f.recordMonth.value = reqForm.recordMonth.value;
|
||||||
|
|
||||||
|
// 폼 초기화
|
||||||
|
resetBankExpenseForm();
|
||||||
|
|
||||||
|
if(id != null) {
|
||||||
|
f.bankAutoTransferId.value = id;
|
||||||
|
|
||||||
|
ajaxUtil._ajaxMethod(
|
||||||
|
`/api/household/bankAutoTransferExpense/${id}`,
|
||||||
|
{},
|
||||||
|
(response) => {
|
||||||
|
console.log("은행자동이체(지출) 상세 응답값 : ", response);
|
||||||
|
setBankExpenseFormData(response);
|
||||||
|
|
||||||
|
document.querySelector(".modal-bank-expense").ui.open();
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
console.log("error : ", code);
|
||||||
|
},
|
||||||
|
'get',
|
||||||
|
'json'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
document.querySelector(".modal-bank-expense").ui.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 은행이체내역(수입) 상세 값 set
|
||||||
|
const setBankExpenseFormData = (data) => {
|
||||||
|
const form = document.reqBankExpenseForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
form.bankAutoTransferId.value = data.id ?? '';
|
||||||
|
form.householdSeq.value = data.householdSeq ?? '';
|
||||||
|
form.expenseCode.value = data.expenseCode ?? '';
|
||||||
|
form.count.value = data.count ?? '';
|
||||||
|
form.unitCode.value = data.unitCode ?? '';
|
||||||
|
form.unit.value = data.unit ?? '';
|
||||||
|
form.price.value = data.price ?? '';
|
||||||
|
form.sourcePurpose.value = data.sourcePurpose ?? '';
|
||||||
|
form.transferCategoryCode.value = data.transferCategoryCode ?? '';
|
||||||
|
|
||||||
|
toggleSelfInput(form.expenseCode.value, form.transferCategory);
|
||||||
|
toggleSelfInput(form.unitCode.value, form.unit);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// form 초기화
|
||||||
|
const resetBankExpenseForm = () => {
|
||||||
|
const form = document.reqBankExpenseForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
const skipInputs = [
|
||||||
|
'householdSeq',
|
||||||
|
'recordMonth'
|
||||||
|
];
|
||||||
|
|
||||||
|
// input 초기화
|
||||||
|
form.querySelectorAll('input').forEach((el) => {
|
||||||
|
if (!skipInputs.includes(el.name)) {
|
||||||
|
el.value = '';
|
||||||
|
|
||||||
|
// 직접입력 영역이면 비활성화 처리
|
||||||
|
const wrapper = el.closest('.self-input') || el.closest('.target-input');
|
||||||
|
if (wrapper) {
|
||||||
|
el.disabled = true;
|
||||||
|
wrapper.classList.add('input-disabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// select 초기화
|
||||||
|
form.querySelectorAll('select').forEach((el) => {
|
||||||
|
el.selectedIndex = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// 은행이체내역(수입) 저장 및 수정
|
||||||
|
const saveBankExpense = () => {
|
||||||
|
const f = document.reqBankExpenseForm;
|
||||||
|
if (!f) return;
|
||||||
|
|
||||||
|
let dataOj = $(f).serializeObject();
|
||||||
|
console.log("dataOj", dataOj);
|
||||||
|
|
||||||
|
ajaxUtil._ajaxMethod(
|
||||||
|
'/api/household/bank/expense/save',
|
||||||
|
JSON.stringify(dataOj),
|
||||||
|
() => { // 성공
|
||||||
|
alert("등록이 완료되었습니다.");
|
||||||
|
|
||||||
|
document.querySelector(".modal-bank-expense").ui.close();
|
||||||
|
getBankAutoTransfer();
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
if(code == 422) alert(rstData.responseJSON[0].defaultMessage);
|
||||||
|
},
|
||||||
|
'post',
|
||||||
|
'json',
|
||||||
|
{ handle422Type: 'alert' }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// 지출의 종류 선택에 따른 직접입력 input 과 대상 input disabled 처리
|
||||||
|
const selectedExpenseCategory = (el) => {
|
||||||
|
const f = document.reqBankExpenseForm;
|
||||||
|
f.expenseCode.value = '';
|
||||||
|
|
||||||
|
const selectedOption = el.options[el.selectedIndex];
|
||||||
|
const codeValue = selectedOption.dataset.codeValue;
|
||||||
|
|
||||||
|
f.expenseCode.value = codeValue;
|
||||||
|
|
||||||
|
const tr = el.closest('tr');
|
||||||
|
const selfArea = tr.querySelector('.self-input');
|
||||||
|
const selfInput = tr.querySelector('.self-input input');
|
||||||
|
|
||||||
|
if (el.value?.endsWith('.self')) {
|
||||||
|
selfInput.disabled = false;
|
||||||
|
selfArea.classList.remove('input-disabled');
|
||||||
|
} else {
|
||||||
|
selfInput.disabled = true;
|
||||||
|
selfInput.value = '';
|
||||||
|
selfArea.classList.add('input-disabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</html>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
<!-- 직접입력 항목 -->
|
<!-- 직접입력 항목 -->
|
||||||
<div class="component-input self-input">
|
<div class="component-input self-input">
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<input type="text" id="transferCategorySelf" name="transferCategory" disabled>
|
<input type="text" class="transfer-category-self" name="transferCategory" disabled>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="component-input target-input">
|
<div class="component-input target-input">
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<input type="text" id="transferCategoryTarget" name="transferCategory" maxlength="30" disabled>
|
<input type="text" class="transfer-category-target" name="transferCategory" maxlength="30" disabled>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -210,8 +210,8 @@
|
|||||||
form.transferCategoryCode.value = data.transferCategoryCode ?? '';
|
form.transferCategoryCode.value = data.transferCategoryCode ?? '';
|
||||||
|
|
||||||
// transferCategory 분기 처리
|
// transferCategory 분기 처리
|
||||||
setTransferCategory(data.transferCategoryCode, data.transferCategory);
|
setTransferCategory(form, data.transferCategoryCode, data.transferCategory);
|
||||||
toggleSelfInput(form.unitCode.value, '#unit');
|
toggleSelfInput(form.unitCode.value, form.unit);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -222,7 +222,6 @@
|
|||||||
if (!form) return;
|
if (!form) return;
|
||||||
|
|
||||||
const skipInputs = [
|
const skipInputs = [
|
||||||
'bankAutoTransferId',
|
|
||||||
'householdSeq',
|
'householdSeq',
|
||||||
'recordMonth'
|
'recordMonth'
|
||||||
];
|
];
|
||||||
@@ -325,11 +324,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 분기 처리 유틸
|
// 분기 처리 유틸
|
||||||
const setTransferCategory = (code, value) => {
|
const setTransferCategory = (form, code, value) => {
|
||||||
const selfInput = document.querySelector('#transferCategorySelf');
|
const selfInput = form.querySelector('.transfer-category-self');
|
||||||
const targetInput = document.querySelector('#transferCategoryTarget');
|
const targetInput = form.querySelector('.transfer-category-target');
|
||||||
|
|
||||||
const isSelf = code === 'code.bank.input.self';
|
const isSelf = code.endsWith('.self');
|
||||||
|
|
||||||
if (isSelf) {
|
if (isSelf) {
|
||||||
selfInput.value = value ?? '';
|
selfInput.value = value ?? '';
|
||||||
@@ -339,12 +338,11 @@
|
|||||||
targetInput.value = value ?? '';
|
targetInput.value = value ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleSelfInput(code, '#transferCategorySelf');
|
toggleSelfInput(code, selfInput);
|
||||||
toggleTargetInput(code, '#transferCategoryTarget');
|
toggleTargetInput(code, targetInput);
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleSelfInput = (code, inputSelector) => {
|
const toggleSelfInput = (code, el) => {
|
||||||
const el = document.querySelector(inputSelector);
|
|
||||||
const wrapper = el.closest('.self-input');
|
const wrapper = el.closest('.self-input');
|
||||||
const isSelf = code.endsWith('.self');
|
const isSelf = code.endsWith('.self');
|
||||||
|
|
||||||
@@ -353,8 +351,7 @@
|
|||||||
if (!isSelf) el.value = '';
|
if (!isSelf) el.value = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleTargetInput = (code, inputSelector) => {
|
const toggleTargetInput = (code, el) => {
|
||||||
const el = document.querySelector(inputSelector);
|
|
||||||
const wrapper = el.closest('.target-input');
|
const wrapper = el.closest('.target-input');
|
||||||
|
|
||||||
const needTarget = !['code.bank.input.10', 'code.bank.input.12', 'code.bank.input.13', 'code.bank.input.self', ''].includes(code);
|
const needTarget = !['code.bank.input.10', 'code.bank.input.12', 'code.bank.input.13', 'code.bank.input.self', ''].includes(code);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<h3>수입 <strong>(<span id="bankIncomeCount">0</span>건)</strong></h3>
|
<h3>수입 <strong>(<span id="bankIncomeCount">0</span>건)</strong></h3>
|
||||||
<div class="component-btns bottom-btn-group">
|
<div class="component-btns bottom-btn-group">
|
||||||
<div class="btns-row align-right">
|
<div class="btns-row align-right">
|
||||||
<button type="button" class="btn small btn-secondary">
|
<button type="button" class="btn small btn-secondary" data-remove-type="INCOME" onclick="removeBankConfirm(this);">
|
||||||
<span class=" btn-txt">삭제</span>
|
<span class=" btn-txt">삭제</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn small btn-primary" onclick="showBankIncomeModal();">
|
<button type="button" class="btn small btn-primary" onclick="showBankIncomeModal();">
|
||||||
@@ -46,10 +46,10 @@
|
|||||||
<h3>지출 <strong>(<span id="bankExpenseCount">0</span>건)</strong></h3>
|
<h3>지출 <strong>(<span id="bankExpenseCount">0</span>건)</strong></h3>
|
||||||
<div class="component-btns bottom-btn-group">
|
<div class="component-btns bottom-btn-group">
|
||||||
<div class="btns-row align-right">
|
<div class="btns-row align-right">
|
||||||
<button type="button" class="btn small btn-secondary">
|
<button type="button" class="btn small btn-secondary" data-remove-type="EXPENSE" onclick="removeBankConfirm(this);">
|
||||||
<span class=" btn-txt">삭제</span>
|
<span class=" btn-txt">삭제</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn small btn-primary">
|
<button type="button" class="btn small btn-primary" onclick="showBankExpenseModal();">
|
||||||
<span class="btn-txt">추가</span>
|
<span class="btn-txt">추가</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
<label class="checkbox-inner">
|
<label class="checkbox-inner">
|
||||||
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
|
<input type="checkbox" id="income_removeIds_${item.id}" name="removeIds" value="${item.id}">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -155,11 +155,11 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
<label class="checkbox-inner">
|
<label class="checkbox-inner">
|
||||||
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
|
<input type="checkbox" id="expense_removeIds_${item.id}" name="removeIds" value="${item.id}">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="underline">${ifNullHyphen(item.categoryText)}</td> <!-- 지출의 종류 -->
|
<td class="underline"><a href="javascript:void(0);" onclick="showBankExpenseModal(${item.id})">${ifNullHyphen(item.categoryText)}</a></td> <!-- 지출의 종류 -->
|
||||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 용도 -->
|
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 용도 -->
|
||||||
<td class="align-right">${ifNullHyphen(item.count)}</td><!-- 수량 -->
|
<td class="align-right">${ifNullHyphen(item.count)}</td><!-- 수량 -->
|
||||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||||
@@ -170,6 +170,54 @@
|
|||||||
|
|
||||||
tbody.append(tmpl);
|
tbody.append(tmpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 은행자동이체내역 삭제 Confirm
|
||||||
|
const removeBankConfirm = (el) => {
|
||||||
|
const section = el.closest('section');
|
||||||
|
const checkedInputs = section.querySelectorAll('input[name="removeIds"]:checked');
|
||||||
|
const checkedIds = Array.from(checkedInputs).map(input => Number(input.value));
|
||||||
|
|
||||||
|
const removeType = el.dataset.removeType;
|
||||||
|
const removeTypeText = el.dataset.removeType === 'INCOME' ? '수입' : '지출';
|
||||||
|
|
||||||
|
if(checkedIds.length <= 0) {
|
||||||
|
alert(`은행자동이체내역(${removeTypeText})을 선택해주세요.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
etUI.dialog.confirm({
|
||||||
|
title: '삭제 안내',
|
||||||
|
message: '선택하신 내용을 삭제하시겠습니까?<br>삭제한 항목은 복구할 수 없습니다.',
|
||||||
|
positiveCallback: function () {
|
||||||
|
removeBank(checkedIds, removeType, removeTypeText);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 은행자동이체내역 삭제
|
||||||
|
const removeBank = (checkedIds, removeType, removeTypeText) => {
|
||||||
|
const f = document.reqForm;
|
||||||
|
|
||||||
|
ajaxUtil._ajaxMethod(
|
||||||
|
'/api/household/bank/delete',
|
||||||
|
JSON.stringify({
|
||||||
|
householdSeq: f.householdSeq.value,
|
||||||
|
recordMonth: f.recordMonth.value,
|
||||||
|
removeType: removeType,
|
||||||
|
removeIds: checkedIds
|
||||||
|
}),
|
||||||
|
() => { // 성공
|
||||||
|
alert(`은행자동이체내역(${removeTypeText})이 삭제되었습니다.`);
|
||||||
|
getBankAutoTransfer();
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
if(code == 422) alert(rstData.responseText);
|
||||||
|
if(code == 400) alert(rstData.responseJSON.message);
|
||||||
|
},
|
||||||
|
'delete',
|
||||||
|
'json',
|
||||||
|
);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</html>
|
</html>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn small btn-secondary" style="display: none;" onclick="showDeleteForestProductConfirm();">
|
<button type="button" class="btn small btn-secondary" style="display: none;" onclick="removeForestProductConfirm();">
|
||||||
<span class=" btn-txt">삭제</span>
|
<span class=" btn-txt">삭제</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn small btn-primary" style="display: none;" onclick="showForestProductModal();">
|
<button type="button" class="btn small btn-primary" style="display: none;" onclick="showForestProductModal();">
|
||||||
@@ -78,23 +78,27 @@
|
|||||||
(response) => { // 성공
|
(response) => { // 성공
|
||||||
console.log("임산물 현황 리스트 조회 : ", response);
|
console.log("임산물 현황 리스트 조회 : ", response);
|
||||||
|
|
||||||
// 임산물 현황 등록 상태 id set
|
|
||||||
f.monthlyInputStatusId.value = response.monthlyStatus.id;
|
|
||||||
|
|
||||||
// 이번달 등록내용 없음 체크 - NONE : 미등록, NOTHING : 이번달 등록내용 없음 , REGISTERED : 등록완료
|
|
||||||
$('#forestProductStatus').attr('checked', response.monthlyStatus.forestStatus === 'NOTHING');
|
|
||||||
|
|
||||||
// 이번달 등록내용 없음 에 따라 버튼 hide 처리
|
|
||||||
showForestProductNoneBtn();
|
|
||||||
|
|
||||||
const tbody = $('.tab-content.forest-product tbody');
|
const tbody = $('.tab-content.forest-product tbody');
|
||||||
tbody.empty();
|
tbody.empty();
|
||||||
|
|
||||||
if(response.forestProducts.length === 0) {
|
// TODO(ks) : monthlyStatus 없을 경우 처리 추가... 일단 .. 이렇게 처리 하지만.. 또 다른 방안이 있을지...
|
||||||
|
if (!response.monthlyStatus || !response.monthlyStatus.status) {
|
||||||
|
noDataMonthly(tbody, null, 15);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!response.forestProducts || response.forestProducts.length === 0) {
|
||||||
noDataMonthly(tbody, response.monthlyStatus.status, 15);
|
noDataMonthly(tbody, response.monthlyStatus.status, 15);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 임산물 현황 등록 상태 id set
|
||||||
|
f.monthlyInputStatusId.value = response.monthlyStatus.id;
|
||||||
|
// 이번달 등록내용 없음 체크 - NONE : 미등록, NOTHING : 이번달 등록내용 없음 , REGISTERED : 등록완료
|
||||||
|
$('#forestProductStatus').attr('checked', response.monthlyStatus.forestStatus === 'NOTHING');
|
||||||
|
// 이번달 등록내용 없음 에 따라 버튼 hide 처리
|
||||||
|
showForestProductNoneBtn();
|
||||||
|
|
||||||
let tmpl = '';
|
let tmpl = '';
|
||||||
$(response.forestProducts).each((idx, item) => {
|
$(response.forestProducts).each((idx, item) => {
|
||||||
tmpl +=
|
tmpl +=
|
||||||
@@ -209,7 +213,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 임산물현황 삭제 Confirm
|
// 임산물현황 삭제 Confirm
|
||||||
const showDeleteForestProductConfirm = () => {
|
const removeForestProductConfirm = () => {
|
||||||
const checkedIds = Array.from(
|
const checkedIds = Array.from(
|
||||||
document.querySelectorAll('input[name="forestRemoveIds"]:checked')
|
document.querySelectorAll('input[name="forestRemoveIds"]:checked')
|
||||||
).map(el => Number(el.value));
|
).map(el => Number(el.value));
|
||||||
@@ -223,13 +227,13 @@
|
|||||||
title: '삭제 안내',
|
title: '삭제 안내',
|
||||||
message: '선택하신 내용을 삭제하시겠습니까?<br>삭제한 항목은 복구할 수 없습니다.',
|
message: '선택하신 내용을 삭제하시겠습니까?<br>삭제한 항목은 복구할 수 없습니다.',
|
||||||
positiveCallback: function () {
|
positiveCallback: function () {
|
||||||
goDeleteForestProduct(checkedIds);
|
removeForestProduct(checkedIds);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 임산물현황 삭제
|
// 임산물현황 삭제
|
||||||
const goDeleteForestProduct = (checkedIds) => {
|
const removeForestProduct = (checkedIds) => {
|
||||||
const f = document.reqForm;
|
const f = document.reqForm;
|
||||||
|
|
||||||
ajaxUtil._ajaxMethod(
|
ajaxUtil._ajaxMethod(
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -196,8 +196,11 @@
|
|||||||
<!-- 임산물현황등록 모달 -->
|
<!-- 임산물현황등록 모달 -->
|
||||||
<th:block th:replace="households/modal/modal-forest-product :: modalFragment"/>
|
<th:block th:replace="households/modal/modal-forest-product :: modalFragment"/>
|
||||||
|
|
||||||
<!-- 은행자동이체 모달 -->
|
<!-- 은행자동이체(수입) 모달 -->
|
||||||
<th:block th:replace="households/modal/modal-bank-auto-transfer-income :: modalFragment"/>
|
<th:block th:replace="households/modal/modal-bank-auto-transfer-income :: modalFragment"/>
|
||||||
|
|
||||||
|
<!-- 은행자동이체(지출) 모달 -->
|
||||||
|
<th:block th:replace="households/modal/modal-bank-auto-transfer-expense :: modalFragment"/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section layout:fragment="script">
|
<section layout:fragment="script">
|
||||||
|
|||||||
Reference in New Issue
Block a user