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);
|
||||
}
|
||||
|
||||
@@ -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.getBankAutoTransferIncome.adapters.persistence.GetBankAutoTransferIncomeMapper">
|
||||
<select id="getBankAutoTransferIncome"
|
||||
resultType="app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferIncome.ports.application.domain.GetBankAutoTransferIncome">
|
||||
/* getBankAutoTransferIncome : 은행자동이체(수입) 상세 조회 */
|
||||
SELECT id,
|
||||
household_seq,
|
||||
crop_code,
|
||||
income_code,
|
||||
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,20 @@
|
||||
<?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.monthlyInputStatus.getMonthlyInputStatus.adapters.persistence.GetMonthlyInputStatusMapper">
|
||||
<select id="getMonthlyInputStatus"
|
||||
resultType="app.module.admin.usecase.household.monthlyInputStatus.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus">
|
||||
/* getMonthlyInputStatus : 월별 입력상태 상세 조회 */
|
||||
SELECT id,
|
||||
household_seq,
|
||||
month,
|
||||
forest_product_status,
|
||||
bank_auto_transfer_input_status,
|
||||
bank_auto_transfer_output_status
|
||||
FROM monthly_input_status
|
||||
WHERE is_deleted = false
|
||||
AND household_seq = #{householdSeq}
|
||||
AND month = #{recordMonth}
|
||||
</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" >
|
||||
<mapper
|
||||
namespace="app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.adapters.persistence.RemoveForestProductsMapper">
|
||||
<update id="removeForestProducts">
|
||||
/* removeForestProducts : 임산물현황 삭제*/
|
||||
<update id="remove">
|
||||
/* remove : 임산물현황 삭제*/
|
||||
UPDATE forest_product
|
||||
SET <include refid="common.fields.DeleteBaseSet"/>
|
||||
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>
|
||||
@@ -0,0 +1,66 @@
|
||||
<?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.saveBankAutoTransferIncome.adapters.persistence.SaveBankAutoTransferIncomeMapper">
|
||||
<insert id="createBankAutoTransferIncome">
|
||||
/* createBankAutoTransferIncome : 은행자동이체(수입) 등록 */
|
||||
INSERT INTO bank_auto_transfer
|
||||
(
|
||||
household_seq,
|
||||
month,
|
||||
crop_code,
|
||||
income_code,
|
||||
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},
|
||||
#{cropCode},
|
||||
#{incomeCode},
|
||||
#{expenseCode},
|
||||
#{transferCategoryCode},
|
||||
#{transferCategory},
|
||||
#{sourcePurpose},
|
||||
#{count},
|
||||
#{unitCode},
|
||||
#{unit},
|
||||
#{price},
|
||||
#{transferType},
|
||||
#{monthlyInputStatusId},
|
||||
#{category},
|
||||
<include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateBankAutoTransferIncome">
|
||||
/* updateBankAutoTransferIncome : 은행자동이체(수입) 수정 */
|
||||
UPDATE bank_auto_transfer
|
||||
SET
|
||||
household_seq = #{householdSeq},
|
||||
crop_code = #{cropCode},
|
||||
income_code = #{incomeCode},
|
||||
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>
|
||||
@@ -3,12 +3,30 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper
|
||||
namespace="app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence.UpdateMonthlyInputStatusMapper">
|
||||
<update id="updateForestProductStatus">
|
||||
/* updateForestProductStatus : 임산물현황 입력상태 수정 */
|
||||
UPDATE monthly_input_status
|
||||
SET forest_product_status = #{status},
|
||||
<include refid="common.fields.UpdateBaseSet"/>
|
||||
WHERE is_deleted = false
|
||||
AND id = #{id}
|
||||
</update>
|
||||
<update id="updateForestProductStatus">
|
||||
/* updateForestProductStatus : 임산물현황 입력상태 수정 */
|
||||
UPDATE monthly_input_status
|
||||
SET forest_product_status = #{status},
|
||||
<include refid="common.fields.UpdateBaseSet"/>
|
||||
WHERE is_deleted = false
|
||||
AND id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateBankInputStatus">
|
||||
/* updateBankInputStatus : 은행자동이체(수입) 입력상태 수정 */
|
||||
UPDATE monthly_input_status
|
||||
SET bank_auto_transfer_input_status = #{status},
|
||||
<include refid="common.fields.UpdateBaseSet"/>
|
||||
WHERE is_deleted = false
|
||||
AND id = #{id}
|
||||
</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>
|
||||
@@ -467,7 +467,15 @@ const formatNumberWithComma = (value) => {
|
||||
|
||||
const limitMaxLength = (el) => {
|
||||
const maxLength = parseInt(el.getAttribute('maxlength'), 10);
|
||||
el.value = el.value.replace(/\D/g, '').slice(0, maxLength);
|
||||
let $el = $(el);
|
||||
|
||||
if ($el.val().length > maxLength) {
|
||||
$el.val(el.val().slice(0, $el.attr('maxlength')));
|
||||
}
|
||||
|
||||
if ($el.attr('inputmode') === 'numeric') {
|
||||
$el.val($el.val().replace('.', ''));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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>
|
||||
@@ -0,0 +1,365 @@
|
||||
<!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="reqBankIncomeForm">
|
||||
<input type="hidden" name="bankAutoTransferId">
|
||||
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||
<input type="hidden" name="recordMonth">
|
||||
<input type="hidden" name="incomeCode">
|
||||
<input type="hidden" name="expenseCode">
|
||||
|
||||
|
||||
<div class="component-modal mypage-wrap modal01 modal-bank-income" 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>재배형태</th>
|
||||
<td>
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="cropCode" required>
|
||||
<option value="">선택</option>
|
||||
<option th:each="item : ${recordCrop}"
|
||||
th:value="${item.id}"
|
||||
th:text="${item.codeText}">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<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="selectedIncomeCategory(this);" required>
|
||||
<option value="">선택</option>
|
||||
<option th:each="item : ${bankInputCodes}"
|
||||
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>대상<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||
<td>
|
||||
<div class="component-input target-input">
|
||||
<div class="input-field">
|
||||
<input type="text" class="transfer-category-target" name="transferCategory" maxlength="30" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<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="saveBankIncome();">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="modal-close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
// 은행자동이체(수입) 모달창 띄우기
|
||||
const showBankIncomeModal = (id) => {
|
||||
const f = document.reqBankIncomeForm;
|
||||
const reqForm = document.reqForm;
|
||||
|
||||
f.recordMonth.value = reqForm.recordMonth.value;
|
||||
|
||||
// 폼 초기화
|
||||
resetBankIncomeForm();
|
||||
|
||||
if(id != null) {
|
||||
f.bankAutoTransferId.value = id;
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
`/api/household/bankAutoTransferIncome/${id}`,
|
||||
{},
|
||||
(response) => {
|
||||
console.log("은행자동이체(수입) 상세 응답값 : ", response);
|
||||
setBankIncomeFormData(response);
|
||||
|
||||
document.querySelector(".modal-bank-income").ui.open();
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
} else {
|
||||
document.querySelector(".modal-bank-income").ui.open();
|
||||
}
|
||||
}
|
||||
|
||||
// 은행이체내역(수입) 상세 값 set
|
||||
const setBankIncomeFormData = (data) => {
|
||||
const form = document.reqBankIncomeForm;
|
||||
if (!form) return;
|
||||
|
||||
form.bankAutoTransferId.value = data.id ?? '';
|
||||
form.householdSeq.value = data.householdSeq ?? '';
|
||||
form.cropCode.value = data.cropCode ?? '';
|
||||
form.incomeCode.value = data.incomeCode ?? '';
|
||||
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 ?? '';
|
||||
|
||||
// transferCategory 분기 처리
|
||||
setTransferCategory(form, data.transferCategoryCode, data.transferCategory);
|
||||
toggleSelfInput(form.unitCode.value, form.unit);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// form 초기화
|
||||
const resetBankIncomeForm = () => {
|
||||
const form = document.reqBankIncomeForm;
|
||||
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 saveBankIncome = () => {
|
||||
const f = document.reqBankIncomeForm;
|
||||
if (!f) return;
|
||||
|
||||
let dataOj = $(f).serializeObject();
|
||||
console.log("dataOj", dataOj);
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/household/bank/income/save',
|
||||
JSON.stringify(dataOj),
|
||||
() => { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
|
||||
document.querySelector(".modal-bank-income").ui.close();
|
||||
getBankAutoTransfer();
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseJSON[0].defaultMessage);
|
||||
},
|
||||
'post',
|
||||
'json',
|
||||
{ handle422Type: 'alert' }
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 수입의 종류 선택에 따른 직접입력 input 과 대상 input disabled 처리
|
||||
const selectedIncomeCategory = (el) => {
|
||||
const f = document.reqBankIncomeForm;
|
||||
f.incomeCode.value = '';
|
||||
f.expenseCode.value = '';
|
||||
|
||||
const selectedOption = el.options[el.selectedIndex];
|
||||
const codeValue = selectedOption.dataset.codeValue;
|
||||
const codeType = selectedOption.dataset.codeType;
|
||||
|
||||
if(codeType == 'INPUT') {
|
||||
f.incomeCode.value = codeValue;
|
||||
} else {
|
||||
f.expenseCode.value = codeValue;
|
||||
}
|
||||
|
||||
const tr = el.closest('tr');
|
||||
const selfArea = tr.querySelector('.self-input');
|
||||
const selfInput = tr.querySelector('.self-input input');
|
||||
|
||||
const targetArea = tr.querySelector('.target-input');
|
||||
const targetInput = tr.querySelector('.target-input input');
|
||||
|
||||
// 직접입력 선택시 직접입력 input disabled 해제
|
||||
if (el.value === 'code.bank.input.self') {
|
||||
selfInput.disabled = false;
|
||||
selfArea.classList.remove('input-disabled');
|
||||
} else {
|
||||
selfInput.disabled = true;
|
||||
selfInput.value = '';
|
||||
selfArea.classList.add('input-disabled');
|
||||
}
|
||||
|
||||
if(el.value !== 'code.bank.input.10' // 연금
|
||||
&& el.value !== 'code.bank.input.12' // 통장 인출/해약
|
||||
&& el.value !== 'code.bank.input.13' // 예금/적금 만기
|
||||
&& el.value !== 'code.bank.input.self' // 직접입력
|
||||
&& el.value !== '') {
|
||||
targetInput.disabled = false;
|
||||
targetArea.classList.remove('input-disabled');
|
||||
} else {
|
||||
targetInput.disabled = true;
|
||||
targetInput.value = '';
|
||||
targetArea.classList.add('input-disabled');
|
||||
}
|
||||
}
|
||||
|
||||
// 분기 처리 유틸
|
||||
const setTransferCategory = (form, code, value) => {
|
||||
const selfInput = form.querySelector('.transfer-category-self');
|
||||
const targetInput = form.querySelector('.transfer-category-target');
|
||||
|
||||
const isSelf = code.endsWith('.self');
|
||||
|
||||
if (isSelf) {
|
||||
selfInput.value = value ?? '';
|
||||
targetInput.value = '';
|
||||
} else {
|
||||
selfInput.value = '';
|
||||
targetInput.value = value ?? '';
|
||||
}
|
||||
|
||||
toggleSelfInput(code, selfInput);
|
||||
toggleTargetInput(code, targetInput);
|
||||
};
|
||||
|
||||
const toggleSelfInput = (code, el) => {
|
||||
const wrapper = el.closest('.self-input');
|
||||
const isSelf = code.endsWith('.self');
|
||||
|
||||
el.disabled = !isSelf;
|
||||
wrapper.classList.toggle('input-disabled', !isSelf);
|
||||
if (!isSelf) el.value = '';
|
||||
};
|
||||
|
||||
const toggleTargetInput = (code, el) => {
|
||||
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);
|
||||
|
||||
el.disabled = !needTarget;
|
||||
wrapper.classList.toggle('input-disabled', !needTarget);
|
||||
if (!needTarget) el.value = '';
|
||||
};
|
||||
</script>
|
||||
</div>
|
||||
</html>
|
||||
@@ -12,10 +12,10 @@
|
||||
<h3>수입 <strong>(<span id="bankIncomeCount">0</span>건)</strong></h3>
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<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>
|
||||
</button>
|
||||
<button type="button" class="btn small btn-primary">
|
||||
<button type="button" class="btn small btn-primary" onclick="showBankIncomeModal();">
|
||||
<span class="btn-txt">추가</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -46,10 +46,10 @@
|
||||
<h3>지출 <strong>(<span id="bankExpenseCount">0</span>건)</strong></h3>
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<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>
|
||||
</button>
|
||||
<button type="button" class="btn small btn-primary">
|
||||
<button type="button" class="btn small btn-primary" onclick="showBankExpenseModal();">
|
||||
<span class="btn-txt">추가</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -118,12 +118,12 @@
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<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>
|
||||
</div>
|
||||
</td>
|
||||
<td>${ifNullHyphen(item.cropText)}</td> <!-- 재배형태 -->
|
||||
<td class="underline">${ifNullHyphen(item.categoryText)}</td> <!-- 수입의 종류 -->
|
||||
<td class="underline"><a href="javascript:void(0);" onclick="showBankIncomeModal(${item.id})">${ifNullHyphen(item.categoryText)}</td> <!-- 수입의 종류 -->
|
||||
<td>${ifNullHyphen(item.target)}</td><!-- 대상 -->
|
||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 수입원 -->
|
||||
<td class="align-right">${ifNullHyphen(item.count)}</td><!-- 수량 -->
|
||||
@@ -155,11 +155,11 @@
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<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>
|
||||
</div>
|
||||
</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 class="align-right">${ifNullHyphen(item.count)}</td><!-- 수량 -->
|
||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||
@@ -170,6 +170,54 @@
|
||||
|
||||
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>
|
||||
</div>
|
||||
</html>
|
||||
@@ -22,7 +22,7 @@
|
||||
</label>
|
||||
</span>
|
||||
</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>
|
||||
</button>
|
||||
<button type="button" class="btn small btn-primary" style="display: none;" onclick="showForestProductModal();">
|
||||
@@ -78,23 +78,27 @@
|
||||
(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');
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
// 임산물 현황 등록 상태 id set
|
||||
f.monthlyInputStatusId.value = response.monthlyStatus.id;
|
||||
// 이번달 등록내용 없음 체크 - NONE : 미등록, NOTHING : 이번달 등록내용 없음 , REGISTERED : 등록완료
|
||||
$('#forestProductStatus').attr('checked', response.monthlyStatus.forestStatus === 'NOTHING');
|
||||
// 이번달 등록내용 없음 에 따라 버튼 hide 처리
|
||||
showForestProductNoneBtn();
|
||||
|
||||
let tmpl = '';
|
||||
$(response.forestProducts).each((idx, item) => {
|
||||
tmpl +=
|
||||
@@ -209,7 +213,7 @@
|
||||
}
|
||||
|
||||
// 임산물현황 삭제 Confirm
|
||||
const showDeleteForestProductConfirm = () => {
|
||||
const removeForestProductConfirm = () => {
|
||||
const checkedIds = Array.from(
|
||||
document.querySelectorAll('input[name="forestRemoveIds"]:checked')
|
||||
).map(el => Number(el.value));
|
||||
@@ -223,13 +227,13 @@
|
||||
title: '삭제 안내',
|
||||
message: '선택하신 내용을 삭제하시겠습니까?<br>삭제한 항목은 복구할 수 없습니다.',
|
||||
positiveCallback: function () {
|
||||
goDeleteForestProduct(checkedIds);
|
||||
removeForestProduct(checkedIds);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 임산물현황 삭제
|
||||
const goDeleteForestProduct = (checkedIds) => {
|
||||
const removeForestProduct = (checkedIds) => {
|
||||
const f = document.reqForm;
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -200,6 +200,12 @@
|
||||
|
||||
<!-- 임산물현황등록 모달 -->
|
||||
<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-expense :: modalFragment"/>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
@@ -233,16 +239,23 @@
|
||||
|
||||
<script>
|
||||
const tabStorageName = 'tabActive';
|
||||
const monthStorageName = 'recordMonth';
|
||||
let tabActive = 'tab1';
|
||||
let tabMonth = document.reqForm.recordMonth.value;
|
||||
window.onpageshow = function (event) {
|
||||
if (event.persisted || (window.performance && window.performance.navigation.type == 1)) {
|
||||
if (('sessionStorage' in window) && window['sessionStorage'] !== null) {
|
||||
if (sessionStorage.getItem(tabStorageName)) {
|
||||
tabActive = sessionStorage.getItem(tabStorageName);
|
||||
}
|
||||
if (sessionStorage.getItem(monthStorageName)) {
|
||||
tabMonth = sessionStorage.getItem(monthStorageName);
|
||||
document.reqForm.recordMonth.value = tabMonth;
|
||||
}
|
||||
}
|
||||
} else if (event.persisted || (window.performance && window.performance.navigation.type == 2)) {
|
||||
sessionStorage.removeItem(tabStorageName);
|
||||
sessionStorage.removeItem(monthStorageName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +280,7 @@
|
||||
const selectedTab = document.querySelector('.tab-label[aria-selected="true"]');
|
||||
if (!selectedTab) return;
|
||||
|
||||
getTabData(selectedTab.dataset.tabType);
|
||||
getTabData(selectedTab.dataset.tabType, selectedTab.dataset.tabValue);
|
||||
}
|
||||
|
||||
const getTabData = (tabType, tabValue) => {
|
||||
@@ -287,6 +300,7 @@
|
||||
}
|
||||
|
||||
sessionStorage.setItem(tabStorageName, tabValue);
|
||||
sessionStorage.setItem(monthStorageName, document.reqForm.recordMonth.value);
|
||||
|
||||
document.querySelector('.component-tab').ui.setValue(tabValue);
|
||||
|
||||
@@ -397,6 +411,22 @@
|
||||
wrap.querySelector('.component-input').classList.remove('input-disabled');
|
||||
}
|
||||
}
|
||||
|
||||
// 직접입력 선택시 input 활성화
|
||||
const selectedSelf = (el) => {
|
||||
const tr = el.closest('tr');
|
||||
const unitArea = tr.querySelector('.self-input');
|
||||
const unitInput = tr.querySelector('.self-input input');
|
||||
|
||||
if (el.value?.endsWith('.self')) {
|
||||
unitInput.disabled = false;
|
||||
unitArea.classList.remove('input-disabled');
|
||||
} else {
|
||||
unitInput.disabled = true;
|
||||
unitInput.value = '';
|
||||
unitArea.classList.add('input-disabled');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user