Merge branch 'dev' into bo_daily
# Conflicts:
# admin/src/main/resources/templates/households/{seq}.html
This commit is contained in:
@@ -32,12 +32,15 @@ class GetHouseholdStatusUIController {
|
||||
model.addAttribute("recordMonth", recordMonth);
|
||||
model.addAttribute("userRole", AdminUtil.getLoginUserRole());
|
||||
|
||||
model.addAttribute("unitCodes", uiCodeListPortIn.connect("code.record.unit"));
|
||||
model.addAttribute("recordCrop", uiCodeListPortIn.connect("code.record.crop"));
|
||||
model.addAttribute("recordUnit", uiCodeListPortIn.connect("code.record.unit"));
|
||||
model.addAttribute("recordArea", uiCodeListPortIn.connect("code.record.area"));
|
||||
model.addAttribute("recordFarming", uiCodeListPortIn.connect("code.record.farming"));
|
||||
|
||||
model.addAttribute("countUnitCodes", uiCodeListPortIn.connect("code.count.unit"));
|
||||
model.addAttribute("bankInputCodes", uiCodeListPortIn.connect("code.bank.input"));
|
||||
model.addAttribute("bankOutputCodes", uiCodeListPortIn.connect("code.bank.output"));
|
||||
|
||||
// 임가 상세 정보
|
||||
model.addAttribute("householdInfo",
|
||||
getHouseholdStatusPortIn.operate(new GetHouseholdStatusCmd(seq)).orElse(null));
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.adapters.persistence;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.GetMonthlyInputStatusPortOut;
|
||||
import java.util.Optional;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetMonthlyInputStatusDao implements GetMonthlyInputStatusPortOut {
|
||||
private final GetMonthlyInputStatusMapper mapper;
|
||||
|
||||
@Override
|
||||
public Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd cmd) {
|
||||
return mapper.getMonthlyInputStatus(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.adapters.persistence;
|
||||
|
||||
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 java.util.Optional;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GetMonthlyInputStatusMapper {
|
||||
Optional<GetMonthlyInputStatus> getMonthlyInputStatus(GetMonthlyInputStatusCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports;
|
||||
|
||||
import java.util.Optional;
|
||||
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||
|
||||
public interface GetMonthlyInputStatusPortIn {
|
||||
Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports;
|
||||
|
||||
import java.util.Optional;
|
||||
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||
|
||||
public interface GetMonthlyInputStatusPortOut {
|
||||
Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.GetMonthlyInputStatusPortIn;
|
||||
import app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortOut;
|
||||
import java.util.Optional;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetMonthlyInputStatusService implements GetMonthlyInputStatusPortIn {
|
||||
private final GetMonthlyInputStatusPortOut portOut;
|
||||
|
||||
@Override
|
||||
public Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd cmd) {
|
||||
return portOut.operate(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetMonthlyInputStatus {
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private String month;
|
||||
private String forestProductStatus;
|
||||
private String bankAutoTransferInputStatus;
|
||||
private String bankAutoTransferOutputStatus;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetMonthlyInputStatusCmd {
|
||||
private Long householdSeq;
|
||||
private String recordMonth;
|
||||
}
|
||||
@@ -6,4 +6,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface UpdateMonthlyInputStatusMapper {
|
||||
void updateForestProductStatus(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;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.adapters.persistence;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain.GetBankAutoTransferIncome;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain.GetBankAutoTransferIncomeCmd;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.GetBankAutoTransferIncomePortOut;
|
||||
import java.util.Optional;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetBankAutoTransferIncomeDao implements GetBankAutoTransferIncomePortOut {
|
||||
private final GetBankAutoTransferIncomeMapper mapper;
|
||||
|
||||
@Override
|
||||
public Optional<GetBankAutoTransferIncome> operate(GetBankAutoTransferIncomeCmd cmd) {
|
||||
return mapper.getBankAutoTransferIncome(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain.GetBankAutoTransferIncome;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain.GetBankAutoTransferIncomeCmd;
|
||||
import java.util.Optional;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GetBankAutoTransferIncomeMapper {
|
||||
Optional<GetBankAutoTransferIncome> getBankAutoTransferIncome(GetBankAutoTransferIncomeCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.GetBankAutoTransferIncomePortIn;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain.GetBankAutoTransferIncomeCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class GetBankAutoTransferIncomeController {
|
||||
private final GetBankAutoTransferIncomePortIn portIn;
|
||||
|
||||
@GetMapping(path = "/api/household/bankAutoTransferIncome/{id}")
|
||||
ResponseEntity<?> operate(@PathVariable Long id) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(portIn.operate(new GetBankAutoTransferIncomeCmd(id)).orElse(null));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetBankAutoTransferIncomeReqVO {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetBankAutoTransferIncomeResVO {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports;
|
||||
|
||||
import java.util.Optional;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain.GetBankAutoTransferIncome;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain.GetBankAutoTransferIncomeCmd;
|
||||
|
||||
public interface GetBankAutoTransferIncomePortIn {
|
||||
Optional<GetBankAutoTransferIncome> operate(GetBankAutoTransferIncomeCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports;
|
||||
|
||||
import java.util.Optional;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain.GetBankAutoTransferIncome;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain.GetBankAutoTransferIncomeCmd;
|
||||
|
||||
public interface GetBankAutoTransferIncomePortOut {
|
||||
Optional<GetBankAutoTransferIncome> operate(GetBankAutoTransferIncomeCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain.GetBankAutoTransferIncome;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain.GetBankAutoTransferIncomeCmd;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.GetBankAutoTransferIncomePortIn;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.GetBankAutoTransferIncomePortOut;
|
||||
import java.util.Optional;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetBankAutoTransferIncomeService implements GetBankAutoTransferIncomePortIn {
|
||||
private final GetBankAutoTransferIncomePortOut portOut;
|
||||
|
||||
@Override
|
||||
public Optional<GetBankAutoTransferIncome> operate(GetBankAutoTransferIncomeCmd cmd) {
|
||||
return portOut.operate(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetBankAutoTransferIncome {
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private String cropCode;
|
||||
private String incomeCode;
|
||||
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.getBankAutoTransferIncome.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetBankAutoTransferIncomeCmd {
|
||||
private Long id;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.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.saveBankAutoTransferIncome.ports.application.domain.SaveBankAutoTransferIncomeOutCmd;
|
||||
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||
import app.module.core.config.application.util.AuditUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports.application.domain.SaveBankAutoTransferIncomeInCmd;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports.SaveBankAutoTransferIncomePortOut;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class SaveBankAutoTransferIncomeDao implements SaveBankAutoTransferIncomePortOut {
|
||||
private final SaveBankAutoTransferIncomeMapper saveBankAutoTransferIncomeMapper;
|
||||
private final UpdateMonthlyInputStatusMapper updateMonthlyInputStatusMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void operate(SaveBankAutoTransferIncomeOutCmd outCmd) {
|
||||
if (outCmd.getBankAutoTransferId() == null) {
|
||||
// 등록 상태가 "REGISTERED"가 아닐 경우 "REGISTERED"로 update
|
||||
if(!MonthlyInputStatusType.REGISTERED.name().equals(outCmd.getBankAutoTransferInputStatus())) {
|
||||
updateMonthlyInputStatusMapper.updateBankInputStatus(
|
||||
new UpdateForestProductStatusCmd(
|
||||
outCmd.getMonthlyInputStatusId(),
|
||||
MonthlyInputStatusType.REGISTERED.name()));
|
||||
}
|
||||
|
||||
// 은행자동이체(수입) 등록
|
||||
saveBankAutoTransferIncomeMapper.createBankAutoTransferIncome(AuditUtil.create(outCmd));
|
||||
} else {
|
||||
// 은행자동이체(수입) update
|
||||
saveBankAutoTransferIncomeMapper.updateBankAutoTransferIncome(AuditUtil.update(outCmd));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports.application.domain.SaveBankAutoTransferIncomeOutCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SaveBankAutoTransferIncomeMapper {
|
||||
void createBankAutoTransferIncome(SaveBankAutoTransferIncomeOutCmd cmd);
|
||||
void updateBankAutoTransferIncome(SaveBankAutoTransferIncomeOutCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
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 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.saveBankAutoTransferIncome.adapters.web.model.SaveBankAutoTransferIncomeReqVO;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.web.model.SaveBankAutoTransferIncomeResVO;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.web.validator.SaveBankAutoTransferIncomeValidator;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class SaveBankAutoTransferIncomeController {
|
||||
private final SaveBankAutoTransferIncomeValidator validator;
|
||||
private final SaveBankAutoTransferIncomePortIn portIn;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
@PostMapping(path = "/api/household/bank/income/save")
|
||||
ResponseEntity<?> operate(@Valid @RequestBody SaveBankAutoTransferIncomeReqVO reqVO,
|
||||
BindingResult bindingResult) {
|
||||
validator.validate(reqVO, bindingResult);
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.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")));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.web.model;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class SaveBankAutoTransferIncomeReqVO {
|
||||
private Long bankAutoTransferId;
|
||||
private Long householdSeq;
|
||||
private String recordMonth;
|
||||
private String cropCode;
|
||||
private String incomeCode;
|
||||
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.saveBankAutoTransferIncome.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class SaveBankAutoTransferIncomeResVO {
|
||||
private String message;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.web.validator;
|
||||
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.web.model.SaveBankAutoTransferIncomeReqVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.Validator;
|
||||
|
||||
@Component
|
||||
public class SaveBankAutoTransferIncomeValidator implements Validator {
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return SaveBankAutoTransferIncomeReqVO.class.equals(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(Object target, Errors errors) {
|
||||
SaveBankAutoTransferIncomeReqVO vo = (SaveBankAutoTransferIncomeReqVO) target;
|
||||
|
||||
// 수입의 종류 null 체크
|
||||
if (!StringUtils.hasText(vo.getTransferCategoryCode())) {
|
||||
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",
|
||||
"현금(원)을 입력해주세요.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports;
|
||||
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports.application.domain.SaveBankAutoTransferIncomeInCmd;
|
||||
|
||||
public interface SaveBankAutoTransferIncomePortIn {
|
||||
void operate(SaveBankAutoTransferIncomeInCmd inCmd);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports;
|
||||
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports.application.domain.SaveBankAutoTransferIncomeOutCmd;
|
||||
|
||||
public interface SaveBankAutoTransferIncomePortOut {
|
||||
void operate(SaveBankAutoTransferIncomeOutCmd outCmd);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.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.saveBankAutoTransferIncome.ports.application.domain.SaveBankAutoTransferIncomeOutCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports.application.domain.SaveBankAutoTransferIncomeInCmd;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports.SaveBankAutoTransferIncomePortIn;
|
||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports.SaveBankAutoTransferIncomePortOut;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class SaveBankAutoTransferIncomeService implements SaveBankAutoTransferIncomePortIn {
|
||||
private final SaveBankAutoTransferIncomePortOut portOut;
|
||||
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
||||
|
||||
@Override
|
||||
public void operate(SaveBankAutoTransferIncomeInCmd inCmd) {
|
||||
|
||||
// 월별 등록상태 조회
|
||||
GetMonthlyInputStatus monthlyInputStatus =
|
||||
getMonthlyInputStatusPortIn
|
||||
.operate(new GetMonthlyInputStatusCmd(inCmd.getHouseholdSeq(), inCmd.getRecordMonth()))
|
||||
.orElse(null);
|
||||
|
||||
portOut.operate(new SaveBankAutoTransferIncomeOutCmd(
|
||||
inCmd.getBankAutoTransferId(),
|
||||
inCmd.getHouseholdSeq(),
|
||||
inCmd.getRecordMonth(),
|
||||
inCmd.getCropCode(),
|
||||
inCmd.getIncomeCode(),
|
||||
inCmd.getExpenseCode(),
|
||||
inCmd.getTransferCategoryCode(),
|
||||
inCmd.getTransferCategory(),
|
||||
inCmd.getSourcePurpose(),
|
||||
inCmd.getCount(),
|
||||
inCmd.getUnitCode(),
|
||||
inCmd.getUnit(),
|
||||
inCmd.getPrice(),
|
||||
"code.bank.input", // 수입 type code
|
||||
"1", // 수입 유형 1 고정
|
||||
monthlyInputStatus.getId(),
|
||||
monthlyInputStatus.getBankAutoTransferInputStatus()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class SaveBankAutoTransferIncomeInCmd {
|
||||
private Long bankAutoTransferId;
|
||||
private Long householdSeq;
|
||||
private String recordMonth;
|
||||
private String cropCode;
|
||||
private String incomeCode;
|
||||
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,30 @@
|
||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.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 SaveBankAutoTransferIncomeOutCmd extends AuditCommand {
|
||||
private Long bankAutoTransferId;
|
||||
private Long householdSeq;
|
||||
private String recordMonth;
|
||||
private String cropCode;
|
||||
private String incomeCode;
|
||||
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 bankAutoTransferInputStatus;
|
||||
}
|
||||
@@ -13,21 +13,21 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class RemoveForestProductsDao implements RemoveForestProductsPortOut {
|
||||
private final RemoveForestProductsMapper removeForestProductsMapper;
|
||||
private final UpdateMonthlyInputStatusMapper updateMonthlyInputStatusMapper;
|
||||
private final RemoveForestProductsMapper removeForestProductsMapper;
|
||||
private final UpdateMonthlyInputStatusMapper updateMonthlyInputStatusMapper;
|
||||
|
||||
@Override
|
||||
@DeleteCommand
|
||||
@Transactional
|
||||
public void operate(RemoveForestProductsCmd cmd) {
|
||||
// 임산물 현황 삭제
|
||||
removeForestProductsMapper.removeForestProducts(cmd);
|
||||
@Override
|
||||
@DeleteCommand
|
||||
@Transactional
|
||||
public void operate(RemoveForestProductsCmd cmd) {
|
||||
// 임산물 현황 삭제
|
||||
removeForestProductsMapper.remove(cmd);
|
||||
|
||||
// 임산물 모두 삭제됐을 경우 입력상태 미등록으로 update
|
||||
if (!removeForestProductsMapper.existsForestProduct(cmd.getMonthlyInputStatusId())) {
|
||||
updateMonthlyInputStatusMapper.updateForestProductStatus(
|
||||
new UpdateForestProductStatusCmd(cmd.getMonthlyInputStatusId(),
|
||||
MonthlyInputStatusType.NONE.name()));
|
||||
// 임산물 모두 삭제됐을 경우 입력상태 미등록으로 update
|
||||
if (!removeForestProductsMapper.existsForestProduct(cmd.getMonthlyInputStatusId())) {
|
||||
updateMonthlyInputStatusMapper.updateForestProductStatus(
|
||||
new UpdateForestProductStatusCmd(cmd.getMonthlyInputStatusId(),
|
||||
MonthlyInputStatusType.NONE.name()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface RemoveForestProductsMapper {
|
||||
void removeForestProducts(RemoveForestProductsCmd cmd);
|
||||
void remove(RemoveForestProductsCmd cmd);
|
||||
boolean existsForestProduct(Long monthlyInputStatusId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user