자동이체 - 수입 완료 (형태 변경 아직 필요)
This commit is contained in:
@@ -0,0 +1,51 @@
|
|||||||
|
package app.module.front.usecase.info.bank.createBank.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.createBank.adapters.persistence.model.CreateForestProductDto;
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.CreateBankPortOut;
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.application.domain.CreateBank;
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.application.domain.CreateBankCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class CreateBankDao implements CreateBankPortOut {
|
||||||
|
|
||||||
|
private final CreateBankMapper mapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public Optional<CreateBank> operate(CreateBankCmd cmd) {
|
||||||
|
|
||||||
|
|
||||||
|
CreateForestProductDto dto =
|
||||||
|
new CreateForestProductDto(
|
||||||
|
null,
|
||||||
|
cmd.getHouseholdSeq(),
|
||||||
|
cmd.getTransferType(),
|
||||||
|
cmd.getCropCode(),
|
||||||
|
cmd.getTransferCategoryCode(),
|
||||||
|
cmd.getTransferCategory(),
|
||||||
|
cmd.getIncomeCode(),
|
||||||
|
cmd.getExpenseCode(),
|
||||||
|
cmd.getSourcePurpose(),
|
||||||
|
cmd.getCount(),
|
||||||
|
cmd.getUnitCode(),
|
||||||
|
cmd.getPrice(),
|
||||||
|
cmd.getMonth(),
|
||||||
|
cmd.getMonthlyInputStatusId(),
|
||||||
|
cmd.getCreatedAt(),
|
||||||
|
cmd.getCreatedBy(),
|
||||||
|
cmd.getUpdatedAt(),
|
||||||
|
cmd.getUpdatedBy()
|
||||||
|
);
|
||||||
|
|
||||||
|
mapper.createBank(dto);
|
||||||
|
|
||||||
|
|
||||||
|
return Optional.of(new CreateBank(dto.getId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.module.front.usecase.info.bank.createBank.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.createBank.adapters.persistence.model.CreateForestProductDto;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CreateBankMapper {
|
||||||
|
void createBank(CreateForestProductDto dto);
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package app.module.front.usecase.info.bank.createBank.adapters.persistence.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CreateForestProductDto {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private Long householdSeq;
|
||||||
|
|
||||||
|
private String transferType;
|
||||||
|
|
||||||
|
private String cropCode;
|
||||||
|
private String transferCategoryCode;
|
||||||
|
private String transferCategory;
|
||||||
|
|
||||||
|
private String incomeCode;
|
||||||
|
private String expenseCode;
|
||||||
|
|
||||||
|
private String sourcePurpose;
|
||||||
|
|
||||||
|
private Integer count;
|
||||||
|
private String unitCode;
|
||||||
|
private Integer price;
|
||||||
|
private String month;
|
||||||
|
|
||||||
|
private Long monthlyInputStatusId;
|
||||||
|
|
||||||
|
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
private String createdBy;
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
private String updatedBy;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package app.module.front.usecase.info.bank.createBank.ports;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.application.domain.CreateBank;
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.application.domain.CreateBankCmd;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface CreateBankPortIn {
|
||||||
|
|
||||||
|
Optional<CreateBank> operate(CreateBankCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package app.module.front.usecase.info.bank.createBank.ports;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.application.domain.CreateBank;
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.application.domain.CreateBankCmd;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface CreateBankPortOut {
|
||||||
|
|
||||||
|
Optional<CreateBank> operate(CreateBankCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package app.module.front.usecase.info.bank.createBank.ports.application;
|
||||||
|
|
||||||
|
import app.module.core.config.application.annotation.CreateCommand;
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.CreateBankPortIn;
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.CreateBankPortOut;
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.application.domain.CreateBank;
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.application.domain.CreateBankCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class CreateBankService implements CreateBankPortIn {
|
||||||
|
|
||||||
|
private final CreateBankPortOut portOut;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@CreateCommand
|
||||||
|
public Optional<CreateBank> operate(CreateBankCmd command) {
|
||||||
|
return portOut.operate(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.module.front.usecase.info.bank.createBank.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class CreateBank {
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package app.module.front.usecase.info.bank.createBank.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
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class CreateBankCmd extends AuditCommand {
|
||||||
|
private Long householdSeq;
|
||||||
|
private String transferType;
|
||||||
|
|
||||||
|
private String cropCode;
|
||||||
|
private String transferCategoryCode;
|
||||||
|
private String transferCategory;
|
||||||
|
|
||||||
|
private String incomeCode;
|
||||||
|
private String expenseCode;
|
||||||
|
|
||||||
|
private String sourcePurpose;
|
||||||
|
|
||||||
|
private Integer count;
|
||||||
|
private String unitCode;
|
||||||
|
private Integer price;
|
||||||
|
private String month;
|
||||||
|
|
||||||
|
private Long monthlyInputStatusId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package app.module.front.usecase.info.bank.getBanks.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.adapters.persistence.model.GetBanksDto;
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.GetBanksPortOut;
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanks;
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanksCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.collections4.ListUtils;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageImpl;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class GetBanksDao implements GetBanksPortOut {
|
||||||
|
|
||||||
|
private final GetBanksMapper mapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<GetBanks> operate(Pageable pageable, GetBanksCmd command) {
|
||||||
|
// 게시물 목록 얻기
|
||||||
|
List<GetBanksDto> contents =
|
||||||
|
ListUtils.emptyIfNull(mapper.getBanks(pageable, command));
|
||||||
|
|
||||||
|
return new PageImpl<>(
|
||||||
|
contents.stream()
|
||||||
|
.map(
|
||||||
|
article ->
|
||||||
|
new GetBanks(
|
||||||
|
article.getId(),
|
||||||
|
article.getHouseholdSeq(),
|
||||||
|
article.getTransferType(),
|
||||||
|
article.getCropCode(),
|
||||||
|
article.getTransferCategoryCode(),
|
||||||
|
article.getTransferCategory(),
|
||||||
|
article.getIncomeCode(),
|
||||||
|
article.getExpenseCode(),
|
||||||
|
article.getSourcePurpose(),
|
||||||
|
article.getCount(),
|
||||||
|
article.getUnitCode(),
|
||||||
|
article.getPrice(),
|
||||||
|
article.getMonth(),
|
||||||
|
article.getMonthlyInputStatusId(),
|
||||||
|
article.getCreatedAt(),
|
||||||
|
article.getCreatedBy(),
|
||||||
|
article.getUpdatedAt(),
|
||||||
|
article.getUpdatedBy()))
|
||||||
|
.collect(Collectors.toList()),
|
||||||
|
pageable,
|
||||||
|
contents.isEmpty() ? 0 : contents.get(0).getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package app.module.front.usecase.info.bank.getBanks.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.adapters.persistence.model.GetBanksDto;
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanksCmd;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface GetBanksMapper {
|
||||||
|
List<GetBanksDto> getBanks(
|
||||||
|
@Param("pageable") Pageable pageable, @Param("cmd") GetBanksCmd cmd);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package app.module.front.usecase.info.bank.getBanks.adapters.persistence.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetBanksDto {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private Long householdSeq;
|
||||||
|
|
||||||
|
private String transferType;
|
||||||
|
|
||||||
|
private String cropCode;
|
||||||
|
private String transferCategoryCode;
|
||||||
|
private String transferCategory;
|
||||||
|
|
||||||
|
private String incomeCode;
|
||||||
|
private String expenseCode;
|
||||||
|
|
||||||
|
private String sourcePurpose;
|
||||||
|
|
||||||
|
private Integer count;
|
||||||
|
private String unitCode;
|
||||||
|
private Integer price;
|
||||||
|
private String month;
|
||||||
|
|
||||||
|
private Long monthlyInputStatusId;
|
||||||
|
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
private String createdBy;
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
private String updatedBy;
|
||||||
|
|
||||||
|
private Long total;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.module.front.usecase.info.bank.getBanks.ports;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanks;
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanksCmd;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
public interface GetBanksPortIn {
|
||||||
|
|
||||||
|
Page<GetBanks> operate(Pageable pageable, GetBanksCmd command);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.module.front.usecase.info.bank.getBanks.ports;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanks;
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanksCmd;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
public interface GetBanksPortOut {
|
||||||
|
|
||||||
|
Page<GetBanks> operate(Pageable pageable, GetBanksCmd command);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.module.front.usecase.info.bank.getBanks.ports.application;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.GetBanksPortIn;
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.GetBanksPortOut;
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanks;
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanksCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class GetBanksService implements GetBanksPortIn {
|
||||||
|
|
||||||
|
private final GetBanksPortOut portOut;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<GetBanks> operate(Pageable pageable, GetBanksCmd command) {
|
||||||
|
return portOut.operate(pageable, command);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package app.module.front.usecase.info.bank.getBanks.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetBanks {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private Long householdSeq;
|
||||||
|
|
||||||
|
private String transferType;
|
||||||
|
|
||||||
|
private String cropCode;
|
||||||
|
private String transferCategoryCode;
|
||||||
|
private String transferCategory;
|
||||||
|
|
||||||
|
private String incomeCode;
|
||||||
|
private String expenseCode;
|
||||||
|
|
||||||
|
private String sourcePurpose;
|
||||||
|
|
||||||
|
private Integer count;
|
||||||
|
private String unitCode;
|
||||||
|
private Integer price;
|
||||||
|
private String month;
|
||||||
|
|
||||||
|
private Long monthlyInputStatusId;
|
||||||
|
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
private String createdBy;
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
private String updatedBy;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package app.module.front.usecase.info.bank.getBanks.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetBanksCmd {
|
||||||
|
|
||||||
|
private Long monthlyInputStatusId;
|
||||||
|
private Long householdSeq;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package app.module.front.usecase.info.bank.removeBanks.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.core.config.application.util.CommonUtil;
|
||||||
|
import app.module.front.usecase.info.bank.removeBanks.adapters.persistence.model.RemoveBanksDto;
|
||||||
|
import app.module.front.usecase.info.bank.removeBanks.ports.RemoveBanksPortOut;
|
||||||
|
import app.module.front.usecase.info.bank.removeBanks.ports.application.domain.RemoveBanksCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class RemoveBanksDao implements RemoveBanksPortOut {
|
||||||
|
|
||||||
|
private final RemoveBanksMapper mapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operate(RemoveBanksCmd command) {
|
||||||
|
String loginUser = CommonUtil.getLoginUsername();;
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
|
||||||
|
mapper.deleteBanks(
|
||||||
|
new RemoveBanksDto(command.getMonthlyInputStatusId(), command.getHouseholdSeq(), command.getTransferType(), now, loginUser, now, loginUser));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.module.front.usecase.info.bank.removeBanks.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.removeBanks.adapters.persistence.model.RemoveBanksDto;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface RemoveBanksMapper {
|
||||||
|
void deleteBanks(RemoveBanksDto param);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package app.module.front.usecase.info.bank.removeBanks.adapters.persistence.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RemoveBanksDto {
|
||||||
|
private Long monthlyInputStatusId;
|
||||||
|
private Long householdSeq;
|
||||||
|
private String transferType;
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
private String updatedBy;
|
||||||
|
private LocalDateTime deletedAt;
|
||||||
|
private String deletedBy;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package app.module.front.usecase.info.bank.removeBanks.ports;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.removeBanks.ports.application.domain.RemoveBanksCmd;
|
||||||
|
|
||||||
|
public interface RemoveBanksPortIn {
|
||||||
|
void operate(RemoveBanksCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package app.module.front.usecase.info.bank.removeBanks.ports;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.removeBanks.ports.application.domain.RemoveBanksCmd;
|
||||||
|
|
||||||
|
public interface RemoveBanksPortOut {
|
||||||
|
void operate(RemoveBanksCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package app.module.front.usecase.info.bank.removeBanks.ports.application;
|
||||||
|
|
||||||
|
import app.module.front.usecase.info.bank.removeBanks.ports.RemoveBanksPortIn;
|
||||||
|
import app.module.front.usecase.info.bank.removeBanks.ports.RemoveBanksPortOut;
|
||||||
|
import app.module.front.usecase.info.bank.removeBanks.ports.application.domain.RemoveBanksCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class RemoveBanksService implements RemoveBanksPortIn {
|
||||||
|
|
||||||
|
private final RemoveBanksPortOut portOut;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operate(RemoveBanksCmd command) {
|
||||||
|
portOut.operate(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package app.module.front.usecase.info.bank.removeBanks.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class RemoveBanksCmd {
|
||||||
|
private Long monthlyInputStatusId;
|
||||||
|
private Long householdSeq;
|
||||||
|
|
||||||
|
private String transferType;
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package app.module.front.usecase.info.bankUI.getBankInputUI.adapters.web;
|
||||||
|
|
||||||
|
import app.module.core.config.application.enums.MonthStatus;
|
||||||
|
import app.module.core.config.application.util.CoreUtil;
|
||||||
|
import app.module.core.usecase.uicode.view.ports.UICodeViewPortIn;
|
||||||
|
import app.module.core.usecase.uicode.view.ports.application.domain.UICodeView;
|
||||||
|
import app.module.front.config.application.response.ApiResponse;
|
||||||
|
import app.module.front.config.application.util.AuthUtil;
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.CreateBankPortIn;
|
||||||
|
import app.module.front.usecase.info.bank.createBank.ports.application.domain.CreateBankCmd;
|
||||||
|
import app.module.front.usecase.info.bank.removeBanks.ports.RemoveBanksPortIn;
|
||||||
|
import app.module.front.usecase.info.bank.removeBanks.ports.application.domain.RemoveBanksCmd;
|
||||||
|
import app.module.front.usecase.info.bankUI.getBankInputUI.adapters.web.model.CreateBankInputProductReqVO;
|
||||||
|
import app.module.front.usecase.info.bankUI.getBankInputUI.adapters.web.model.CreateBankInputReqVO;
|
||||||
|
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortIn;
|
||||||
|
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||||
|
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||||
|
import app.module.front.usecase.info.monthly.updateMonthlyInputStatus.ports.UpdateMonthlyInputStatusPortIn;
|
||||||
|
import app.module.front.usecase.info.monthly.updateMonthlyInputStatus.ports.application.domain.UpdateMonthlyInputStatusCmd;
|
||||||
|
import app.module.front.usecase.info.monthlyProduct.createForestProduct.ports.CreateForestProductPortIn;
|
||||||
|
import app.module.front.usecase.info.monthlyProduct.createForestProduct.ports.application.domain.CreateForestProductCmd;
|
||||||
|
import app.module.front.usecase.info.monthlyProduct.removeMonthForestProducts.ports.RemoveMonthForestProductsPortIn;
|
||||||
|
import app.module.front.usecase.info.monthlyProduct.removeMonthForestProducts.ports.application.domain.RemoveMonthForestProductsCmd;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class CreateBankInputController {
|
||||||
|
|
||||||
|
|
||||||
|
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
||||||
|
private final CreateBankPortIn createBankPortIn;
|
||||||
|
private final UpdateMonthlyInputStatusPortIn updateMonthlyInputStatusPortIn;
|
||||||
|
|
||||||
|
private final RemoveBanksPortIn removeBanksPortIn;
|
||||||
|
|
||||||
|
private final CoreUtil coreUtil;
|
||||||
|
private final UICodeViewPortIn uiCodeViewPortIn;
|
||||||
|
|
||||||
|
@PostMapping(path = "/api/front/info/bank/create")
|
||||||
|
ResponseEntity<?> operate(@RequestBody @Valid CreateBankInputReqVO reqVO, BindingResult bindingResult){
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return coreUtil.getErrorInfo(bindingResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GetMonthlyInputStatus currentMonthlyInfo =
|
||||||
|
getMonthlyInputStatusPortIn.operate(
|
||||||
|
new GetMonthlyInputStatusCmd(
|
||||||
|
reqVO.getId(), AuthUtil.getUserSeq())).orElse(null);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(currentMonthlyInfo!=null) {
|
||||||
|
//TODO 트렌젝션 고려
|
||||||
|
removeBanksPortIn.operate(new RemoveBanksCmd(currentMonthlyInfo.getId(), AuthUtil.getUserSeq(), "code.bank.input"));
|
||||||
|
|
||||||
|
if (!reqVO.getStatus() && reqVO.getBankList() != null && !reqVO.getBankList().isEmpty()) { // 등록없음 처리가 아님.
|
||||||
|
for (CreateBankInputProductReqVO item : reqVO.getBankList()) {
|
||||||
|
|
||||||
|
UICodeView code = uiCodeViewPortIn.connect(item.getTransferCategoryCode()).orElse(null);
|
||||||
|
if(code != null) {
|
||||||
|
createBankPortIn.operate(new CreateBankCmd(
|
||||||
|
AuthUtil.getUserSeq(),
|
||||||
|
"code.bank.input",
|
||||||
|
item.getCropCode(),
|
||||||
|
item.getTransferCategoryCode(),
|
||||||
|
item.getTransferCategory(),
|
||||||
|
code.getCodeType().equals("INPUT") ? code.getCodeValue() : null,
|
||||||
|
code.getCodeType().equals("OUTPUT") ?code.getCodeValue() : null,
|
||||||
|
item.getSourcePurpose(),
|
||||||
|
item.getCount(),
|
||||||
|
item.getUnitCode(),
|
||||||
|
item.getPrice(),
|
||||||
|
currentMonthlyInfo.getMonth(),
|
||||||
|
currentMonthlyInfo.getId()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
|
||||||
|
currentMonthlyInfo.getId(),
|
||||||
|
AuthUtil.getUserSeq(),
|
||||||
|
currentMonthlyInfo.getMonth(),
|
||||||
|
currentMonthlyInfo.getBankAutoTransferInputStatus(),
|
||||||
|
MonthStatus.REGISTERED,
|
||||||
|
currentMonthlyInfo.getBankAutoTransferOutputStatus()
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
|
||||||
|
currentMonthlyInfo.getId(),
|
||||||
|
AuthUtil.getUserSeq(),
|
||||||
|
currentMonthlyInfo.getMonth(),
|
||||||
|
currentMonthlyInfo.getBankAutoTransferInputStatus(),
|
||||||
|
MonthStatus.NOTHING,
|
||||||
|
currentMonthlyInfo.getBankAutoTransferOutputStatus()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
return ResponseEntity.ok(ApiResponse.success(null));
|
||||||
|
} else {
|
||||||
|
return ResponseEntity.ok(ApiResponse.failure(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,13 +3,19 @@ package app.module.front.usecase.info.bankUI.getBankInputUI.adapters.web;
|
|||||||
import app.module.core.config.application.enums.MonthStatus;
|
import app.module.core.config.application.enums.MonthStatus;
|
||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import app.module.front.config.application.util.AuthUtil;
|
import app.module.front.config.application.util.AuthUtil;
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.GetBanksPortIn;
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanks;
|
||||||
|
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanksCmd;
|
||||||
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortIn;
|
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortIn;
|
||||||
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||||
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||||
import app.module.front.usecase.info.monthly.getPrevMonthlyInputStatus.ports.GetPrevMonthlyInputStatusPortIn;
|
import app.module.front.usecase.info.monthly.getPrevMonthlyInputStatus.ports.GetPrevMonthlyInputStatusPortIn;
|
||||||
import app.module.front.usecase.info.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
|
import app.module.front.usecase.info.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
|
||||||
import app.module.front.usecase.info.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
|
import app.module.front.usecase.info.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
|
||||||
|
import app.module.front.usecase.info.monthlyProduct.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProducts;
|
||||||
|
import app.module.front.usecase.info.monthlyProduct.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProductsCmd;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.web.PageableDefault;
|
import org.springframework.data.web.PageableDefault;
|
||||||
@@ -29,13 +35,14 @@ class GetBankInputUIController {
|
|||||||
|
|
||||||
private final GetPrevMonthlyInputStatusPortIn prevMonthlyInputStatusPortIn;
|
private final GetPrevMonthlyInputStatusPortIn prevMonthlyInputStatusPortIn;
|
||||||
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
||||||
|
private final GetBanksPortIn getBanksPortIn;
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(path = "/info/bank/create/input/{id}")
|
@GetMapping(path = "/info/bank/create/input/{id}")
|
||||||
public String operate(Model model,
|
public String operate(Model model,
|
||||||
@PathVariable Long id) {
|
@PathVariable Long id
|
||||||
|
,@PageableDefault(sort = "createAt", direction = Sort.Direction.DESC, page = 0, size = 100) Pageable pageable) {
|
||||||
|
|
||||||
String currentMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM"));
|
String currentMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM"));
|
||||||
|
|
||||||
@@ -54,6 +61,22 @@ class GetBankInputUIController {
|
|||||||
new GetMonthlyInputStatusCmd(
|
new GetMonthlyInputStatusCmd(
|
||||||
id, AuthUtil.getUserSeq())).orElse(null);
|
id, AuthUtil.getUserSeq())).orElse(null);
|
||||||
|
|
||||||
|
|
||||||
|
Page<GetBanks> pastList = Page.empty();
|
||||||
|
if (pastMonthlyInfo != null) {
|
||||||
|
pastList = getBanksPortIn.operate(
|
||||||
|
pageable,
|
||||||
|
new GetBanksCmd(pastMonthlyInfo.getId(), AuthUtil.getUserSeq()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Page<GetBanks> currentList = Page.empty();
|
||||||
|
if (currentMonthlyInfo != null) {
|
||||||
|
currentList = getBanksPortIn.operate(
|
||||||
|
pageable,
|
||||||
|
new GetBanksCmd(currentMonthlyInfo.getId(), AuthUtil.getUserSeq()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//수정 가능 여부 판단
|
//수정 가능 여부 판단
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
|
||||||
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth(), formatter);
|
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth(), formatter);
|
||||||
@@ -66,6 +89,11 @@ class GetBankInputUIController {
|
|||||||
model.addAttribute("pastMonthlyInfo", pastMonthlyInfo);
|
model.addAttribute("pastMonthlyInfo", pastMonthlyInfo);
|
||||||
model.addAttribute("currentMonthlyInfo", currentMonthlyInfo);
|
model.addAttribute("currentMonthlyInfo", currentMonthlyInfo);
|
||||||
|
|
||||||
|
|
||||||
|
model.addAttribute("pastBankList", pastList);
|
||||||
|
model.addAttribute("bankList", currentList);
|
||||||
|
|
||||||
|
|
||||||
model.addAttribute("transferCategoryList", uiCodeListPortIn.connect("code.bank.input"));
|
model.addAttribute("transferCategoryList", uiCodeListPortIn.connect("code.bank.input"));
|
||||||
model.addAttribute("codeRecordCropList", uiCodeListPortIn.connect("code.record.crop"));
|
model.addAttribute("codeRecordCropList", uiCodeListPortIn.connect("code.record.crop"));
|
||||||
model.addAttribute("unitList", uiCodeListPortIn.connect("code.record.unit"));
|
model.addAttribute("unitList", uiCodeListPortIn.connect("code.record.unit"));
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package app.module.front.usecase.info.bankUI.getBankInputUI.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class CreateBankInputProductReqVO {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String transferType;
|
||||||
|
|
||||||
|
private String cropCode;
|
||||||
|
private String transferCategoryCode;
|
||||||
|
private String transferCategory;
|
||||||
|
|
||||||
|
private String incomeCode;
|
||||||
|
private String expenseCode;
|
||||||
|
|
||||||
|
private String sourcePurpose;
|
||||||
|
|
||||||
|
private Integer count;
|
||||||
|
private String unitCode;
|
||||||
|
private Integer price;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package app.module.front.usecase.info.bankUI.getBankInputUI.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class CreateBankInputReqVO {
|
||||||
|
|
||||||
|
|
||||||
|
private Boolean status;
|
||||||
|
private Long id;
|
||||||
|
private List<CreateBankInputProductReqVO> bankList;
|
||||||
|
|
||||||
|
public List<CreateBankInputProductReqVO> getBankList() {
|
||||||
|
return bankList != null ? bankList : new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBankList(List<CreateBankInputProductReqVO> bankList) {
|
||||||
|
this.bankList = bankList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,6 +21,6 @@ class RemoveMonthForestProductsDao implements RemoveMonthForestProductsPortOut {
|
|||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
|
||||||
mapper.deleteForestProducts(
|
mapper.deleteForestProducts(
|
||||||
new RemoveMonthForestProductsParam(command.getId(), command.getHouseholdSeq(), now, loginUser, now, loginUser));
|
new RemoveMonthForestProductsParam(command.getMonthlyInputStatusId(), command.getHouseholdSeq(), now, loginUser, now, loginUser));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.time.LocalDateTime;
|
|||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class RemoveMonthForestProductsParam {
|
public class RemoveMonthForestProductsParam {
|
||||||
private Long id;
|
private Long monthlyInputStatusId;
|
||||||
private Long householdSeq;
|
private Long householdSeq;
|
||||||
private LocalDateTime updatedAt;
|
private LocalDateTime updatedAt;
|
||||||
private String updatedBy;
|
private String updatedBy;
|
||||||
|
|||||||
@@ -10,6 +10,6 @@ import lombok.Setter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class RemoveMonthForestProductsCmd {
|
public class RemoveMonthForestProductsCmd {
|
||||||
private Long id;
|
private Long monthlyInputStatusId;
|
||||||
private Long householdSeq;
|
private Long householdSeq;
|
||||||
}
|
}
|
||||||
|
|||||||
57
front/src/main/resources/mappers/bank/CreateBankMapper.xml
Normal file
57
front/src/main/resources/mappers/bank/CreateBankMapper.xml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?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.front.usecase.info.bank.createBank.adapters.persistence.CreateBankMapper">
|
||||||
|
|
||||||
|
<insert id="createBank" keyProperty="id">
|
||||||
|
|
||||||
|
<selectKey keyProperty="id" order="BEFORE" resultType="long">
|
||||||
|
SELECT nextval('bank_auto_transfer_seq')
|
||||||
|
</selectKey>
|
||||||
|
|
||||||
|
INSERT INTO bank_auto_transfer (
|
||||||
|
id,
|
||||||
|
household_seq,
|
||||||
|
transfer_type,
|
||||||
|
crop_code,
|
||||||
|
transfer_category_code,
|
||||||
|
transfer_category,
|
||||||
|
income_code,
|
||||||
|
expense_code,
|
||||||
|
source_purpose,
|
||||||
|
count,
|
||||||
|
unit_code,
|
||||||
|
price,
|
||||||
|
month,
|
||||||
|
monthly_input_status_id,
|
||||||
|
created_at,
|
||||||
|
created_by,
|
||||||
|
updated_at,
|
||||||
|
updated_by,
|
||||||
|
is_deleted
|
||||||
|
) VALUES (
|
||||||
|
#{id},
|
||||||
|
#{householdSeq},
|
||||||
|
#{transferType},
|
||||||
|
#{cropCode},
|
||||||
|
#{transferCategoryCode},
|
||||||
|
#{transferCategory},
|
||||||
|
#{incomeCode},
|
||||||
|
#{expenseCode},
|
||||||
|
#{sourcePurpose},
|
||||||
|
#{count},
|
||||||
|
#{unitCode},
|
||||||
|
#{price},
|
||||||
|
#{month},
|
||||||
|
#{monthlyInputStatusId},
|
||||||
|
#{createdAt},
|
||||||
|
#{createdBy},
|
||||||
|
#{createdAt},
|
||||||
|
#{createdBy},
|
||||||
|
false
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
67
front/src/main/resources/mappers/bank/GetBanksMapper.xml
Normal file
67
front/src/main/resources/mappers/bank/GetBanksMapper.xml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?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.front.usecase.info.bank.getBanks.adapters.persistence.GetBanksMapper">
|
||||||
|
|
||||||
|
<select id="getBanks"
|
||||||
|
resultType="app.module.front.usecase.info.bank.getBanks.adapters.persistence.model.GetBanksDto">
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
|
||||||
|
a.id AS id,
|
||||||
|
a.household_seq AS householdSeq,
|
||||||
|
a.transfer_type AS transferType,
|
||||||
|
a.crop_code AS cropCode,
|
||||||
|
a.transfer_category_code AS transferCategoryCode,
|
||||||
|
a.transfer_category AS transferCategory,
|
||||||
|
a.income_code AS incomeCode,
|
||||||
|
a.expense_code AS expenseCode,
|
||||||
|
a.source_purpose AS sourcePurpose,
|
||||||
|
a.count AS count,
|
||||||
|
a.unit_code AS unitCode,
|
||||||
|
a.price AS price,
|
||||||
|
a.month AS month,
|
||||||
|
a.monthly_input_status_id AS monthlyInputStatusId,
|
||||||
|
a.created_at AS createdAt,
|
||||||
|
a.created_by AS createdBy,
|
||||||
|
a.updated_at AS updatedAt,
|
||||||
|
a.updated_by AS updatedBy,
|
||||||
|
COUNT(*) OVER () AS total
|
||||||
|
FROM bank_auto_transfer a
|
||||||
|
WHERE a.is_deleted = false
|
||||||
|
|
||||||
|
<if test="cmd.monthlyInputStatusId != null">
|
||||||
|
AND a.monthly_input_status_id = #{cmd.monthlyInputStatusId}
|
||||||
|
</if>
|
||||||
|
<if test="cmd.householdSeq != null">
|
||||||
|
AND a.household_seq = #{cmd.householdSeq}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
|
||||||
|
<if test="pageable.sort != null and !pageable.sort.isEmpty()">
|
||||||
|
ORDER BY
|
||||||
|
<foreach collection="pageable.sort" item="order" separator=",">
|
||||||
|
<choose>
|
||||||
|
<when test="order.property eq 'household'">a.household_seq</when>
|
||||||
|
<when test="order.property eq 'updatedBy'">a.updated_by</when>
|
||||||
|
<when test="order.property eq 'updatedAt'">a.updated_at</when>
|
||||||
|
<when test="order.property eq 'createdBy'">a.created_by</when>
|
||||||
|
<when test="order.property eq 'createdAt'">a.created_at</when>
|
||||||
|
<otherwise>a.id</otherwise>
|
||||||
|
</choose>
|
||||||
|
<choose>
|
||||||
|
<when test="order.direction.toString() eq 'DESC'">DESC</when>
|
||||||
|
<otherwise>ASC</otherwise>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
|
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
16
front/src/main/resources/mappers/bank/RemoveBanksMapper.xml
Normal file
16
front/src/main/resources/mappers/bank/RemoveBanksMapper.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?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.front.usecase.info.bank.removeBanks.adapters.persistence.RemoveBanksMapper">
|
||||||
|
<update id="deleteBanks">
|
||||||
|
UPDATE bank_auto_transfer
|
||||||
|
SET <include refid="common.fields.DeleteBaseSet" />
|
||||||
|
WHERE
|
||||||
|
household_seq = #{householdSeq}
|
||||||
|
AND monthly_input_status_id = #{monthlyInputStatusId}
|
||||||
|
AND transfer_type = #{transferType}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<insert id="createForestProduct" keyProperty="id">
|
<insert id="createForestProduct" keyProperty="id">
|
||||||
<!-- createForestProduct 게시글 등록 -->
|
<!-- createForestProduct 게시글 등록 -->
|
||||||
<selectKey keyProperty="id" order="BEFORE" resultType="long">
|
<selectKey keyProperty="id" order="BEFORE" resultType="long">
|
||||||
SELECT nextval('notice_seq')
|
SELECT nextval('monthly_input_status_seq')
|
||||||
</selectKey>
|
</selectKey>
|
||||||
|
|
||||||
INSERT INTO forest_product (
|
INSERT INTO forest_product (
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
SET <include refid="common.fields.DeleteBaseSet" />
|
SET <include refid="common.fields.DeleteBaseSet" />
|
||||||
WHERE
|
WHERE
|
||||||
household_seq = #{householdSeq}
|
household_seq = #{householdSeq}
|
||||||
AND monthly_input_status_id = #{id}
|
AND monthly_input_status_id = #{monthlyInputStatusId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
<div class="component-btns fixed">
|
<div class="component-btns fixed">
|
||||||
<div class="btns-row">
|
<div class="btns-row">
|
||||||
<!-- 비활성화 스타일/ 버튼 속성 disabled 추가-->
|
<!-- 비활성화 스타일/ 버튼 속성 disabled 추가-->
|
||||||
<button type="button" class="btn btn-l btn-primary" id="complateBtn" disabled>
|
<button type="button" class="btn btn-l btn-primary" id="complateBtn" disabled onclick="formControl.goSave()">
|
||||||
<span class="btn-txt">등록 완료</span>
|
<span class="btn-txt">등록 완료</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>"/api/front/info/bank/create"
|
||||||
|
|
||||||
<section layout:fragment="script">
|
<section layout:fragment="script">
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
@@ -111,11 +111,11 @@
|
|||||||
modalPopup: null
|
modalPopup: null
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
transferCategoryList: /*[[${transferCategoryList}]]*/ [],
|
transferCategoryCodeList: /*[[${transferCategoryList}]]*/ [],
|
||||||
codeRecordCropList: /*[[${codeRecordCropList}]]*/ [],
|
codeRecordCropList: /*[[${codeRecordCropList}]]*/ [],
|
||||||
unitList: /*[[${unitList}]]*/ [],
|
unitList: /*[[${unitList}]]*/ [],
|
||||||
bankList : [],
|
bankList : /*[[${bankList.content}]]*/ [],
|
||||||
pastBankList : [],
|
pastBankList : /*[[${pastBankList.content}]]*/ [],
|
||||||
id: /*[[${currentMonthlyInfo.id}]]*/'',
|
id: /*[[${currentMonthlyInfo.id}]]*/'',
|
||||||
currentStatus: /*[[${currentMonthlyInfo.bankAutoTransferInputStatus}]]*/'',
|
currentStatus: /*[[${currentMonthlyInfo.bankAutoTransferInputStatus}]]*/'',
|
||||||
pastStatus: /*[[${pastMonthlyInfo?.bankAutoTransferInputStatus}]]*/'',
|
pastStatus: /*[[${pastMonthlyInfo?.bankAutoTransferInputStatus}]]*/'',
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
noDataCheckbox: document.getElementById("forestProductStatus"),
|
noDataCheckbox: document.getElementById("forestProductStatus"),
|
||||||
select:{
|
select:{
|
||||||
cropCodeSelect : null,
|
cropCodeSelect : null,
|
||||||
transferCategorySelect : null,
|
transferCategoryCodeSelect : null,
|
||||||
unitCodeSelect : null,
|
unitCodeSelect : null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -247,11 +247,12 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const $select2 = document.querySelector('#transferCategorySelect');
|
const $select2 = document.querySelector('#transferCategoryCodeSelect');
|
||||||
ENV.elementRefs.select.transferCategorySelect = new etUI.components.SelectBox();
|
ENV.elementRefs.select.transferCategoryCodeSelect = new etUI.components.SelectBox();
|
||||||
ENV.elementRefs.select.transferCategorySelect.core.init($select2,{
|
ENV.elementRefs.select.transferCategoryCodeSelect.core.init($select2,{
|
||||||
selectItemCallback({selectValue, dataValue}){
|
selectItemCallback({selectValue, dataValue}){
|
||||||
document.querySelector('#transferCategory').value=dataValue;
|
// document.querySelector('#transferCategory').value=selectValue;
|
||||||
|
document.querySelector('#transferCategoryCode').value=dataValue;
|
||||||
document.querySelectorAll('div[data-option]').forEach(el => {
|
document.querySelectorAll('div[data-option]').forEach(el => {
|
||||||
el.style.display = 'none';
|
el.style.display = 'none';
|
||||||
});
|
});
|
||||||
@@ -327,17 +328,17 @@
|
|||||||
|
|
||||||
const form = document.getElementById('popupForm');
|
const form = document.getElementById('popupForm');
|
||||||
kri.form.errorInit(form);
|
kri.form.errorInit(form);
|
||||||
const selects = ['cropCode', 'transferCategory', 'unitCode'];
|
const selects = ['cropCode', 'transferCategoryCode', 'unitCode'];
|
||||||
selects.forEach(id => {
|
selects.forEach(id => {
|
||||||
const sel = document.getElementById(id + 'Select');
|
const sel = document.getElementById(id + 'Select');
|
||||||
if (sel && sel.value) form[id].value = sel.value;
|
if (sel && sel.value) form[id].value = sel.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
const errors = [];
|
const errors = [];
|
||||||
if (!form.transferCategory.value) errors.push({field: 'transferCategory', message: '수입종류를 선택해주세요.'});
|
if (!form.transferCategoryCode.value) errors.push({field: 'transferCategoryCode', message: '수입종류를 선택해주세요.'});
|
||||||
if (form.transferCategory.value && document.getElementById(form.transferCategory.value+"_value")
|
if (form.transferCategoryCode.value && document.getElementById(form.transferCategoryCode.value+"_value")
|
||||||
&& !document.getElementById(form.transferCategory.value+"_value").value){
|
&& !document.getElementById(form.transferCategoryCode.value+"_value").value){
|
||||||
errors.push({field: form.transferCategory.value+"_value", message: '수입대상을 입력해주세요.'});
|
errors.push({field: form.transferCategoryCode.value+"_value", message: '수입대상을 입력해주세요.'});
|
||||||
}
|
}
|
||||||
if (!form.sourcePurpose.value) errors.push({field: 'sourcePurpose', message: '수입원을 입력해주세요.'});
|
if (!form.sourcePurpose.value) errors.push({field: 'sourcePurpose', message: '수입원을 입력해주세요.'});
|
||||||
|
|
||||||
@@ -352,6 +353,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form.transferCategory.value = document.getElementById(form.transferCategoryCode.value+"_value").value;//입력값
|
||||||
const formData = new FormData(form);
|
const formData = new FormData(form);
|
||||||
const product = {};
|
const product = {};
|
||||||
formData.forEach((value, key) => product[key] = value);
|
formData.forEach((value, key) => product[key] = value);
|
||||||
@@ -366,7 +368,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
getCategoryLabel(code) {
|
getCategoryLabel(code) {
|
||||||
const found = ENV.data.transferCategoryList.find(i => i.id === code);
|
const found = ENV.data.transferCategoryCodeList.find(i => i.id === code);
|
||||||
return found ? found.codeText : '-';
|
return found ? found.codeText : '-';
|
||||||
},
|
},
|
||||||
// 단위 코드
|
// 단위 코드
|
||||||
@@ -392,11 +394,16 @@
|
|||||||
|
|
||||||
Object.entries(product).forEach(([key, val]) => {
|
Object.entries(product).forEach(([key, val]) => {
|
||||||
const field = form.elements.namedItem(key);
|
const field = form.elements.namedItem(key);
|
||||||
if (field) field.value = val;
|
if (field) {
|
||||||
|
field.value = val;
|
||||||
|
if(key == 'transferCategoryCode'){
|
||||||
|
document.getElementById(val+"_value").value = product["transferCategory"];
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ENV.elementRefs.select.cropCodeSelect.setValue(product.cropCode);
|
ENV.elementRefs.select.cropCodeSelect.setValue(product.cropCode);
|
||||||
ENV.elementRefs.select.transferCategorySelect.setValue(product.transferCategory);
|
ENV.elementRefs.select.transferCategoryCodeSelect.setValue(product.transferCategoryCode);
|
||||||
ENV.elementRefs.select.unitCodeSelect.setValue(product.unitCode);
|
ENV.elementRefs.select.unitCodeSelect.setValue(product.unitCode);
|
||||||
},100)
|
},100)
|
||||||
|
|
||||||
@@ -412,6 +419,29 @@
|
|||||||
clearAllItems() {
|
clearAllItems() {
|
||||||
location.reload();
|
location.reload();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
goSave() {
|
||||||
|
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsync(
|
||||||
|
ENV.httpUrl.save,
|
||||||
|
{
|
||||||
|
status: ENV.elementRefs.noDataCheckbox.checked,
|
||||||
|
id: ENV.data.id,
|
||||||
|
bankList: ENV.data.bankList
|
||||||
|
},
|
||||||
|
function (rstData, status) {
|
||||||
|
if (rstData.code === 'SUCCESS') {
|
||||||
|
ajaxUtil._alert('등록이 완료되었습니다.', null, function () {
|
||||||
|
|
||||||
|
history.back()
|
||||||
|
});
|
||||||
|
} else if (rstData.code === 'ERROR') {
|
||||||
|
ajaxUtil._alert('잠시 뒤에 다시 시도해 주세요.', null);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -432,8 +462,9 @@
|
|||||||
const getCategory = formControl.getCategoryLabel;
|
const getCategory = formControl.getCategoryLabel;
|
||||||
const getCrop = formControl.getCropLabel;
|
const getCrop = formControl.getCropLabel;
|
||||||
|
|
||||||
const categoryCode = product.transferCategory;
|
const categoryCode = product.transferCategoryCode;
|
||||||
const categoryValue = product[`${categoryCode}_value`];
|
const categoryCodeInputValue = product.transferCategory;
|
||||||
|
const categoryValue = product[`${categoryCode}_value`] ? product[`${categoryCode}_value`] : categoryCodeInputValue;
|
||||||
const tagTitle = categoryCode === 'code.bank.input.99'
|
const tagTitle = categoryCode === 'code.bank.input.99'
|
||||||
? categoryValue
|
? categoryValue
|
||||||
: `${getCategory(categoryCode)}<span>(${categoryValue})</span>`;
|
: `${getCategory(categoryCode)}<span>(${categoryValue})</span>`;
|
||||||
|
|||||||
@@ -57,8 +57,9 @@
|
|||||||
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="transferCategorySelect" class="component-select bottom-sheet" data-props-default="수입 종류를 선택해 주세요"
|
<div id="transferCategoryCodeSelect" class="component-select bottom-sheet" data-props-default="수입 종류를 선택해 주세요"
|
||||||
data-props-type="bottomSheet">
|
data-props-type="bottomSheet">
|
||||||
|
<input type="hidden" name="transferCategoryCode" id="transferCategoryCode" data-type="select"/>
|
||||||
<input type="hidden" name="transferCategory" id="transferCategory" data-type="select"/>
|
<input type="hidden" name="transferCategory" id="transferCategory" data-type="select"/>
|
||||||
<button type="button" class="select-box">
|
<button type="button" class="select-box">
|
||||||
<span class="select-txt"></span>
|
<span class="select-txt"></span>
|
||||||
|
|||||||
Reference in New Issue
Block a user