[BO] 임가현황 - 은행자동이체내역 작업 중 (1)
This commit is contained in:
@@ -32,12 +32,15 @@ class GetHouseholdStatusUIController {
|
|||||||
model.addAttribute("recordMonth", recordMonth);
|
model.addAttribute("recordMonth", recordMonth);
|
||||||
model.addAttribute("userRole", AdminUtil.getLoginUserRole());
|
model.addAttribute("userRole", AdminUtil.getLoginUserRole());
|
||||||
|
|
||||||
model.addAttribute("unitCodes", uiCodeListPortIn.connect("code.record.unit"));
|
|
||||||
model.addAttribute("recordCrop", uiCodeListPortIn.connect("code.record.crop"));
|
model.addAttribute("recordCrop", uiCodeListPortIn.connect("code.record.crop"));
|
||||||
model.addAttribute("recordUnit", uiCodeListPortIn.connect("code.record.unit"));
|
model.addAttribute("recordUnit", uiCodeListPortIn.connect("code.record.unit"));
|
||||||
model.addAttribute("recordArea", uiCodeListPortIn.connect("code.record.area"));
|
model.addAttribute("recordArea", uiCodeListPortIn.connect("code.record.area"));
|
||||||
model.addAttribute("recordFarming", uiCodeListPortIn.connect("code.record.farming"));
|
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",
|
model.addAttribute("householdInfo",
|
||||||
getHouseholdStatusPortIn.operate(new GetHouseholdStatusCmd(seq)).orElse(null));
|
getHouseholdStatusPortIn.operate(new GetHouseholdStatusCmd(seq)).orElse(null));
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
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 {
|
||||||
|
@Override
|
||||||
|
public Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd cmd) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
public interface GetMonthlyInputStatusMapper {
|
||||||
|
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,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface UpdateMonthlyInputStatusMapper {
|
public interface UpdateMonthlyInputStatusMapper {
|
||||||
void updateForestProductStatus(UpdateForestProductStatusCmd cmd);
|
void updateForestProductStatus(UpdateForestProductStatusCmd cmd);
|
||||||
|
void updateBankInputStatus(UpdateForestProductStatusCmd cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,24 @@
|
|||||||
|
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 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,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,34 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.web;
|
||||||
|
|
||||||
|
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 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());
|
||||||
|
}
|
||||||
|
|
||||||
|
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 String 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,40 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 현금
|
||||||
|
if(!StringUtils.hasText(vo.getPrice())) {
|
||||||
|
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 String 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 String price;
|
||||||
|
private String transferType;
|
||||||
|
private String category;
|
||||||
|
private Long monthlyInputStatusId;
|
||||||
|
private String bankAutoTransferInputStatus;
|
||||||
|
}
|
||||||
@@ -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,64 @@
|
|||||||
|
<?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},
|
||||||
|
#{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},
|
||||||
|
price = #{price},
|
||||||
|
<include refid="common.fields.UpdateBaseSet"/>
|
||||||
|
WHERE id = #{bankAutoTransferId}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
@@ -11,4 +11,13 @@
|
|||||||
WHERE is_deleted = false
|
WHERE is_deleted = false
|
||||||
AND id = #{id}
|
AND id = #{id}
|
||||||
</update>
|
</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>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -467,7 +467,15 @@ const formatNumberWithComma = (value) => {
|
|||||||
|
|
||||||
const limitMaxLength = (el) => {
|
const limitMaxLength = (el) => {
|
||||||
const maxLength = parseInt(el.getAttribute('maxlength'), 10);
|
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,368 @@
|
|||||||
|
<!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" id="transferCategorySelf" 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" id="transferCategoryTarget" 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(data.transferCategoryCode, data.transferCategory);
|
||||||
|
toggleSelfInput(form.unitCode.value, '#unit');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// form 초기화
|
||||||
|
const resetBankIncomeForm = () => {
|
||||||
|
const form = document.reqBankIncomeForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
const skipInputs = [
|
||||||
|
'bankAutoTransferId',
|
||||||
|
'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 = (code, value) => {
|
||||||
|
const selfInput = document.querySelector('#transferCategorySelf');
|
||||||
|
const targetInput = document.querySelector('#transferCategoryTarget');
|
||||||
|
|
||||||
|
const isSelf = code === 'code.bank.input.self';
|
||||||
|
|
||||||
|
if (isSelf) {
|
||||||
|
selfInput.value = value ?? '';
|
||||||
|
targetInput.value = '';
|
||||||
|
} else {
|
||||||
|
selfInput.value = '';
|
||||||
|
targetInput.value = value ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleSelfInput(code, '#transferCategorySelf');
|
||||||
|
toggleTargetInput(code, '#transferCategoryTarget');
|
||||||
|
};
|
||||||
|
|
||||||
|
const toggleSelfInput = (code, inputSelector) => {
|
||||||
|
const el = document.querySelector(inputSelector);
|
||||||
|
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, inputSelector) => {
|
||||||
|
const el = document.querySelector(inputSelector);
|
||||||
|
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>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<button type="button" class="btn small btn-secondary">
|
<button type="button" class="btn small btn-secondary">
|
||||||
<span class=" btn-txt">삭제</span>
|
<span class=" btn-txt">삭제</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn small btn-primary">
|
<button type="button" class="btn small btn-primary" onclick="showBankIncomeModal();">
|
||||||
<span class="btn-txt">추가</span>
|
<span class="btn-txt">추가</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>${ifNullHyphen(item.cropText)}</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.target)}</td><!-- 대상 -->
|
||||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 수입원 -->
|
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 수입원 -->
|
||||||
<td class="align-right">${ifNullHyphen(item.count)}</td><!-- 수량 -->
|
<td class="align-right">${ifNullHyphen(item.count)}</td><!-- 수량 -->
|
||||||
|
|||||||
@@ -186,6 +186,9 @@
|
|||||||
|
|
||||||
<!-- 임산물현황등록 모달 -->
|
<!-- 임산물현황등록 모달 -->
|
||||||
<th:block th:replace="households/modal/modal-forest-product :: modalFragment"/>
|
<th:block th:replace="households/modal/modal-forest-product :: modalFragment"/>
|
||||||
|
|
||||||
|
<!-- 은행자동이체 모달 -->
|
||||||
|
<th:block th:replace="households/modal/modal-bank-auto-transfer-income :: modalFragment"/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section layout:fragment="script">
|
<section layout:fragment="script">
|
||||||
@@ -340,6 +343,22 @@
|
|||||||
disableArea.classList.add('input-disabled');
|
disableArea.classList.add('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>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user