Merge branch 'dev' into susu
This commit is contained in:
@@ -41,6 +41,7 @@ public class AdminDetailsService implements UserDetailsService {
|
||||
boolean accountDisabled = Optional.ofNullable(adminUser.getAccountDisabled()).orElse(false);
|
||||
|
||||
return new AdminUser(
|
||||
adminUser.getSeq(),
|
||||
adminUser.getId(),
|
||||
adminUser.getPassword(),
|
||||
adminUser.getRoles().stream().map(CoreRole::getId).findFirst().orElse(null),
|
||||
|
||||
@@ -7,10 +7,12 @@ import org.springframework.security.core.userdetails.User;
|
||||
|
||||
@Getter
|
||||
public class AdminUser extends User {
|
||||
private Long seq;
|
||||
private String roleId;
|
||||
private long remainPasswordDays;
|
||||
|
||||
public AdminUser(
|
||||
Long seq,
|
||||
String username,
|
||||
String password,
|
||||
String roleId,
|
||||
@@ -28,6 +30,7 @@ public class AdminUser extends User {
|
||||
credentialsNonExpired,
|
||||
accountNonLocked,
|
||||
authorities);
|
||||
this.seq = seq;
|
||||
this.roleId = roleId;
|
||||
this.remainPasswordDays = remainPasswordDays;
|
||||
}
|
||||
|
||||
@@ -33,4 +33,14 @@ public class AdminUtil {
|
||||
AdminUser user = (AdminUser) authentication.getPrincipal();
|
||||
return user.getRoleId().isEmpty() ? null : user.getRoleId();
|
||||
}
|
||||
|
||||
public static Long getLoginUserSeq() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication == null || !(authentication.getPrincipal() instanceof AdminUser)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AdminUser user = (AdminUser) authentication.getPrincipal();
|
||||
return user.getSeq();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package app.module.admin.usecase.household.getBankAutoTransferRecords.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferExpenseRecords;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferIncomeRecords;
|
||||
import java.util.Collections;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecords;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecordsCmd;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.GetBankAutoTransferRecordsPortOut;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetBankAutoTransferRecordsDao implements GetBankAutoTransferRecordsPortOut {
|
||||
private final GetBankAutoTransferRecordsMapper mapper;
|
||||
|
||||
@Override
|
||||
public GetBankAutoTransferRecords operate(GetBankAutoTransferRecordsCmd cmd) {
|
||||
return new GetBankAutoTransferRecords(
|
||||
mapper.getBankAutoTransferIncomeRecords(cmd), // 수입
|
||||
mapper.getBankAutoTransferExpenseRecords(cmd)); // 지출
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.module.admin.usecase.household.getBankAutoTransferRecords.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferExpenseRecords;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferIncomeRecords;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecordsCmd;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GetBankAutoTransferRecordsMapper {
|
||||
// 은행자동이체 수입
|
||||
List<GetBankAutoTransferIncomeRecords> getBankAutoTransferIncomeRecords(
|
||||
GetBankAutoTransferRecordsCmd cmd);
|
||||
// 은행자동이체 지출
|
||||
List<GetBankAutoTransferExpenseRecords> getBankAutoTransferExpenseRecords(
|
||||
GetBankAutoTransferRecordsCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package app.module.admin.usecase.household.getBankAutoTransferRecords.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.GetBankAutoTransferRecordsPortIn;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecords;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecordsCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.adapters.web.model.GetAutoTransferRecordsReqVO;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.adapters.web.model.GetAutoTransferRecordsResVO;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class GetBankAutoTransferRecordsController {
|
||||
private final GetBankAutoTransferRecordsPortIn portIn;
|
||||
|
||||
@GetMapping(path = "/api/household/bankAutoTransfer")
|
||||
ResponseEntity<GetBankAutoTransferRecords> operate(GetAutoTransferRecordsReqVO reqVO) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(portIn.operate(
|
||||
new GetBankAutoTransferRecordsCmd(reqVO.getHouseholdSeq(), reqVO.getRecordMonth())));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.admin.usecase.household.getBankAutoTransferRecords.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetAutoTransferRecordsReqVO {
|
||||
private Long householdSeq;
|
||||
private String recordMonth;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.household.getBankAutoTransferRecords.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetAutoTransferRecordsResVO {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.household.getBankAutoTransferRecords.ports;
|
||||
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecords;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecordsCmd;
|
||||
import java.util.List;
|
||||
|
||||
public interface GetBankAutoTransferRecordsPortIn {
|
||||
GetBankAutoTransferRecords operate(GetBankAutoTransferRecordsCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.household.getBankAutoTransferRecords.ports;
|
||||
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecords;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecordsCmd;
|
||||
import java.util.List;
|
||||
|
||||
public interface GetBankAutoTransferRecordsPortOut {
|
||||
GetBankAutoTransferRecords operate(GetBankAutoTransferRecordsCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecords;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecordsCmd;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.GetBankAutoTransferRecordsPortIn;
|
||||
import app.module.admin.usecase.household.getBankAutoTransferRecords.ports.GetBankAutoTransferRecordsPortOut;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetBankAutoTransferRecordsService implements GetBankAutoTransferRecordsPortIn {
|
||||
private final GetBankAutoTransferRecordsPortOut portOut;
|
||||
|
||||
@Override
|
||||
public GetBankAutoTransferRecords operate(GetBankAutoTransferRecordsCmd cmd) {
|
||||
return portOut.operate(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetBankAutoTransferExpenseRecords {
|
||||
private Long id;
|
||||
private String categoryText;
|
||||
private String categorySelf;
|
||||
private String sourcePurpose;
|
||||
private Integer count;
|
||||
private String unitText;
|
||||
private Integer price;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetBankAutoTransferIncomeRecords {
|
||||
private Long id;
|
||||
private String cropText;
|
||||
private String categoryText;
|
||||
private String categorySelf;
|
||||
private String sourcePurpose;
|
||||
private Integer count;
|
||||
private String unitText;
|
||||
private Integer price;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetBankAutoTransferRecords {
|
||||
List<GetBankAutoTransferIncomeRecords> incomes;
|
||||
List<GetBankAutoTransferExpenseRecords> expenses;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetBankAutoTransferRecordsCmd {
|
||||
private Long householdSeq;
|
||||
private String recordMonth;
|
||||
}
|
||||
@@ -14,12 +14,12 @@ public class GetDailyExpenseRecords {
|
||||
private Long id;
|
||||
private String inputType;
|
||||
private Boolean isCredit;
|
||||
private String categoryCode;
|
||||
private String categorySelf;
|
||||
private String sourcePurpose;
|
||||
private BigDecimal quantity;
|
||||
private String unitCode;
|
||||
private String unitText;
|
||||
private String unitSelf;
|
||||
private String price;
|
||||
private String estimatedValue;
|
||||
private String updatedBy;
|
||||
|
||||
@@ -16,12 +16,12 @@ public class GetDailyIncomeRecords {
|
||||
private Boolean isCredit;
|
||||
private String cropCode;
|
||||
private String cropText;
|
||||
private String categoryCode;
|
||||
private String categorySelf;
|
||||
private String sourcePurpose;
|
||||
private BigDecimal quantity;
|
||||
private String unitCode;
|
||||
private String unitText;
|
||||
private String unitSelf;
|
||||
private String price;
|
||||
private String estimatedValue;
|
||||
private String updatedBy;
|
||||
|
||||
@@ -3,6 +3,7 @@ package app.module.admin.usecase.household.getForestProductsStatus.adapters.pers
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.GetForestProductsStatusPortOut;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusResult;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -13,7 +14,13 @@ class GetForestProductsStatusDao implements GetForestProductsStatusPortOut {
|
||||
private final GetForestProductsStatusMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<GetForestProductsStatus> operate(GetForestProductsStatusCmd cmd) {
|
||||
return mapper.getForestProductsStatus(cmd);
|
||||
public GetForestProductsStatusResult operate(GetForestProductsStatusCmd cmd) {
|
||||
|
||||
// 임산물 등록 상태 조회
|
||||
String monthlyStatus = mapper.getMonthlyStatus(cmd);
|
||||
// 임산물 목록 조회
|
||||
List<GetForestProductsStatus> forestProducts = mapper.getForestProductsStatus(cmd);
|
||||
|
||||
return new GetForestProductsStatusResult(monthlyStatus, forestProducts);
|
||||
}
|
||||
}
|
||||
@@ -7,5 +7,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GetForestProductsStatusMapper {
|
||||
String getMonthlyStatus(GetForestProductsStatusCmd cmd);
|
||||
List<GetForestProductsStatus> getForestProductsStatus(GetForestProductsStatusCmd cmd);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package app.module.admin.usecase.household.getForestProductsStatus.adapters.web;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.GetForestProductsStatusPortIn;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusResult;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -18,10 +19,10 @@ class GetForestProductsStatusController {
|
||||
private final GetForestProductsStatusPortIn portIn;
|
||||
|
||||
@GetMapping(path = "/api/household/forestProducts")
|
||||
ResponseEntity<List<GetForestProductsStatus>> operate(
|
||||
ResponseEntity<GetForestProductsStatusResult> operate(
|
||||
GetForestProductsStatusReqVO reqVO) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(portIn.operate(
|
||||
new GetForestProductsStatusCmd(reqVO.getHouseholdSeq(), reqVO.getMonth())));
|
||||
new GetForestProductsStatusCmd(reqVO.getHouseholdSeq(), reqVO.getRecordMonth())));
|
||||
}
|
||||
}
|
||||
@@ -11,5 +11,5 @@ import lombok.Setter;
|
||||
@EqualsAndHashCode
|
||||
public class GetForestProductsStatusReqVO {
|
||||
private Long householdSeq;
|
||||
private String month;
|
||||
private String recordMonth;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.ports;
|
||||
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd;
|
||||
import java.util.List;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusResult;
|
||||
|
||||
public interface GetForestProductsStatusPortIn {
|
||||
List<GetForestProductsStatus> operate(GetForestProductsStatusCmd cmd);
|
||||
GetForestProductsStatusResult operate(GetForestProductsStatusCmd cmd);
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.ports;
|
||||
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd;
|
||||
import java.util.List;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusResult;
|
||||
|
||||
public interface GetForestProductsStatusPortOut {
|
||||
List<GetForestProductsStatus> operate(GetForestProductsStatusCmd cmd);
|
||||
GetForestProductsStatusResult operate(GetForestProductsStatusCmd cmd);
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.ports.application;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.GetForestProductsStatusPortIn;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.GetForestProductsStatusPortOut;
|
||||
import java.util.List;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@@ -14,7 +13,7 @@ class GetForestProductsStatusService implements GetForestProductsStatusPortIn {
|
||||
private final GetForestProductsStatusPortOut portOut;
|
||||
|
||||
@Override
|
||||
public List<GetForestProductsStatus> operate(GetForestProductsStatusCmd cmd) {
|
||||
public GetForestProductsStatusResult operate(GetForestProductsStatusCmd cmd) {
|
||||
return portOut.operate(cmd);
|
||||
}
|
||||
}
|
||||
@@ -11,5 +11,5 @@ import lombok.Setter;
|
||||
@EqualsAndHashCode
|
||||
public class GetForestProductsStatusCmd {
|
||||
private Long householdSeq;
|
||||
private String month;
|
||||
private String recordMonth;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetForestProductsStatusResult {
|
||||
private String monthlyStatus;
|
||||
private List<GetForestProductsStatus> forestProducts;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.admin.usecase.household.getHouseholdVisitInfos.adapters.persistence;
|
||||
|
||||
import java.util.Collections;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfos;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfosCmd;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.GetHouseholdVisitInfosPortOut;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetHouseholdVisitInfosDao implements GetHouseholdVisitInfosPortOut {
|
||||
private final GetHouseholdVisitInfosMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<GetHouseholdVisitInfos> operate(GetHouseholdVisitInfosCmd cmd) {
|
||||
return mapper.getHouseholdVisitInfos(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package app.module.admin.usecase.household.getHouseholdVisitInfos.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfos;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfosCmd;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GetHouseholdVisitInfosMapper {
|
||||
List<GetHouseholdVisitInfos> getHouseholdVisitInfos(GetHouseholdVisitInfosCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package app.module.admin.usecase.household.getHouseholdVisitInfos.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.GetHouseholdVisitInfosPortIn;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfos;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfosCmd;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.adapters.web.model.GetHouseholdVisitInfosReqVO;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.adapters.web.model.GetHouseholdVisitInfosResVO;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class GetHouseholdVisitInfosController {
|
||||
private final GetHouseholdVisitInfosPortIn portIn;
|
||||
|
||||
@GetMapping(path = "/api/household/visitInfos")
|
||||
ResponseEntity<List<GetHouseholdVisitInfos>> operate(
|
||||
GetHouseholdVisitInfosReqVO reqVO) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(portIn.operate(
|
||||
new GetHouseholdVisitInfosCmd(reqVO.getHouseholdSeq(), reqVO.getRecordMonth())));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.admin.usecase.household.getHouseholdVisitInfos.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetHouseholdVisitInfosReqVO {
|
||||
private Long householdSeq;
|
||||
private String recordMonth;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.household.getHouseholdVisitInfos.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetHouseholdVisitInfosResVO {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.household.getHouseholdVisitInfos.ports;
|
||||
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfos;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfosCmd;
|
||||
import java.util.List;
|
||||
|
||||
public interface GetHouseholdVisitInfosPortIn {
|
||||
List<GetHouseholdVisitInfos> operate(GetHouseholdVisitInfosCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.household.getHouseholdVisitInfos.ports;
|
||||
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfos;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfosCmd;
|
||||
import java.util.List;
|
||||
|
||||
public interface GetHouseholdVisitInfosPortOut {
|
||||
List<GetHouseholdVisitInfos> operate(GetHouseholdVisitInfosCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfos;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfosCmd;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.GetHouseholdVisitInfosPortIn;
|
||||
import app.module.admin.usecase.household.getHouseholdVisitInfos.ports.GetHouseholdVisitInfosPortOut;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetHouseholdVisitInfosService implements GetHouseholdVisitInfosPortIn {
|
||||
private final GetHouseholdVisitInfosPortOut portOut;
|
||||
|
||||
@Override
|
||||
public List<GetHouseholdVisitInfos> operate(GetHouseholdVisitInfosCmd cmd) {
|
||||
return portOut.operate(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetHouseholdVisitInfos {
|
||||
private Long id;
|
||||
private String visitDate;
|
||||
private String managementType;
|
||||
private String content;
|
||||
private Boolean isGiftSent;
|
||||
private String updatedBy;
|
||||
private String updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetHouseholdVisitInfosCmd {
|
||||
private Long householdSeq;
|
||||
private String recordMonth;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package app.module.admin.usecase.household.getHouseholdsStatus.adapters.web;
|
||||
|
||||
import app.module.admin.config.application.util.AdminUtil;
|
||||
import app.module.admin.usecase.household.getHouseholdsStatus.ports.GetHouseholdsStatusPortIn;
|
||||
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatusCmd;
|
||||
@@ -42,6 +43,7 @@ class GetHouseholdsStatusController {
|
||||
reqVO.getResearcherField(),
|
||||
reqVO.getResearcherValue(),
|
||||
reqVO.getIsPanel(),
|
||||
AdminUtil.getLoginUserSeq(),
|
||||
reqVO.getUserRole(),
|
||||
reqVO.getUserRegionMainCode()
|
||||
))
|
||||
|
||||
@@ -11,7 +11,8 @@ import lombok.Setter;
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetHouseholdsStatus {
|
||||
private Integer householdSeq;
|
||||
private Long adminSeq;
|
||||
private Long householdSeq;
|
||||
private String householdNum;
|
||||
private String householdName;
|
||||
private String householdPhone;
|
||||
|
||||
@@ -40,6 +40,8 @@ public class GetHouseholdsStatusCmd {
|
||||
private String researcherValue;
|
||||
// 패널 유지 여부
|
||||
private Boolean isPanel;
|
||||
// 로그인한 유저 seq
|
||||
private Long adminSeq;
|
||||
// 로그인한 유저 역할
|
||||
private String userRole;
|
||||
// 로그인한 유저 실사 지역
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?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.getBankAutoTransferRecords.adapters.persistence.GetBankAutoTransferRecordsMapper">
|
||||
<select id="getBankAutoTransferIncomeRecords"
|
||||
resultType="app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferIncomeRecords">
|
||||
/* getBankAutoTransferIncomeRecords : 은행자동이체 (수입) 내역 목록 조회 */
|
||||
SELECT bat.id, /* 수입 id */
|
||||
ui_crop.code_text AS cropText, /* 재배형태 */
|
||||
ui_category.code_text AS categoryText, /* 수입의 종류 (코드명) */
|
||||
bat.transfer_category AS categorySelf, /* 수입의 종류 (텍스트입력) */
|
||||
bat.source_purpose AS sourcePurpose, /* 수입원 */
|
||||
bat.count, /* 수량 */
|
||||
ui_unit.code_text AS unitText, /* 단위 */
|
||||
bat.price /* 현금(원) */
|
||||
FROM bank_auto_transfer bat
|
||||
LEFT JOIN uicode ui_crop ON ui_crop.parent_id = 'code.record.crop' AND ui_crop.id = bat.crop_code
|
||||
LEFT JOIN uicode ui_unit ON ui_unit.parent_id = 'code.record.unit' AND ui_unit.id = bat.unit_code
|
||||
LEFT JOIN uicode ui_category ON ui_category.parent_id = 'code.bank.input' AND ui_category.id = bat.transfer_category_code
|
||||
WHERE bat.transfer_type = 'code.bank.input'
|
||||
AND bat.household_seq = #{householdSeq}
|
||||
AND bat.month = #{recordMonth}
|
||||
</select>
|
||||
|
||||
<select id="getBankAutoTransferExpenseRecords"
|
||||
resultType="app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferExpenseRecords">
|
||||
/* getBankAutoTransferExpenseRecords : 은행자동이체 (지출) 내역 목록 조회 */
|
||||
SELECT bat.id, /* 지출 id */
|
||||
ui_category.code_text AS cropText, /* 지출의 종류 (코드명) */
|
||||
bat.transfer_category AS categorySelf, /* 지출의 종류 (텍스트입력) */
|
||||
bat.source_purpose AS sourcePurpose, /* 용도 */
|
||||
bat.count, /* 수량 */
|
||||
ui_unit.code_text AS unitText, /* 단위 */
|
||||
bat.price /* 현금(원) */
|
||||
FROM bank_auto_transfer bat
|
||||
LEFT JOIN uicode ui_unit ON ui_unit.parent_id = 'code.record.unit' AND ui_unit.id = bat.unit_code
|
||||
LEFT JOIN uicode ui_category ON ui_category.parent_id = 'code.bank.input' AND ui_category.id = bat.transfer_category_code
|
||||
WHERE bat.transfer_type = 'code.bank.output'
|
||||
AND bat.household_seq = #{householdSeq}
|
||||
AND bat.month = #{recordMonth}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -26,12 +26,12 @@
|
||||
di.is_credit, /* 외상판매여부 */
|
||||
di.crop_code, /* 재배형태 코드 */
|
||||
ui_crop.code_text AS crop_text, /* 재배형태 코드 텍스트 */
|
||||
di.category_code, /* 수입 종류 코드 */ -- TODO(ks) : 수입의 종류 코드형태 맞는지 체크할 것
|
||||
di.category_self, /* 수입 종류(직접입력) */
|
||||
di.source_purpose, /* 수입원(용도) */
|
||||
di.quantity, /* 수량 */
|
||||
di.unit_code, /* 단위 코드 */
|
||||
ui_unit.code_text AS unit_text, /* 단위 코드 텍스트 */
|
||||
di.unit_self, /* 단위(직접입력) */
|
||||
di.price, /* 현금 */
|
||||
di.estimated_value, /* 현물평가액 */
|
||||
di.updated_by, /* 최종수정자 */
|
||||
@@ -77,12 +77,12 @@
|
||||
SELECT de.id, /* 지출 id */
|
||||
de.input_type, /* 입력구분 */
|
||||
de.is_credit, /* 외상판매여부 */
|
||||
de.category_code, /* 재배형태 코드 */
|
||||
de.category_self, /* 지출 종류 코드 */
|
||||
de.source_purpose, /* 지출원(용도) */
|
||||
de.quantity, /* 수량 */
|
||||
de.unit_code, /* 단위 */
|
||||
ui_unit.code_text AS unit_text, /* 단위 코드 텍스트 */
|
||||
de.unit_self, /* 단위(직접입력) */
|
||||
de.price, /* 현금 */
|
||||
de.estimated_value, /* 현물평가액 */
|
||||
de.updated_by, /* 최종수정자 */
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper
|
||||
namespace="app.module.admin.usecase.household.getForestProductsStatus.adapters.persistence.GetForestProductsStatusMapper">
|
||||
|
||||
<select id="getMonthlyStatus" resultType="java.lang.String">
|
||||
/* getMonthlyStatus : 임산물 현황 등록 상태 조회 */
|
||||
SELECT forest_product_status
|
||||
FROM monthly_input_status mis
|
||||
WHERE household_seq = #{householdSeq}
|
||||
AND month = #{recordMonth}
|
||||
AND is_deleted = false
|
||||
</select>
|
||||
|
||||
<select id="getForestProductsStatus"
|
||||
resultType="app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus">
|
||||
/* getForestProductsStatus : 임가 현황의 임산물 현황 목록 조회 */
|
||||
@@ -28,7 +38,7 @@
|
||||
LEFT JOIN uicode ui_sub_yield ON ui_sub_yield.parent_id = 'code.record.unit' AND ui_sub_yield.id = df.sub_yield_unit_code
|
||||
LEFT JOIN uicode ui_sub_sale ON ui_sub_sale.parent_id = 'code.record.unit' AND ui_sub_sale.id = df.sub_sale_unit_code
|
||||
WHERE df.household_seq = #{householdSeq}
|
||||
AND df.month = #{month}
|
||||
AND df.month = #{recordMonth}
|
||||
AND df.is_deleted = false
|
||||
</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.getHouseholdVisitInfos.adapters.persistence.GetHouseholdVisitInfosMapper">
|
||||
<select id="getHouseholdVisitInfos"
|
||||
resultType="app.module.admin.usecase.household.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfos">
|
||||
/* getHouseholdVisitInfos : 임가방문정보 리스트 조회 */
|
||||
SELECT hv.id,
|
||||
hv.visit_date,
|
||||
hv.management_type,
|
||||
hv.content,
|
||||
hv.is_gift_sent,
|
||||
hv.updated_by,
|
||||
TO_CHAR(hv.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
|
||||
FROM household_visit hv
|
||||
WHERE household_seq = #{householdSeq}
|
||||
AND TO_CHAR(visit_date, 'YYYYMM') = #{recordMonth}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -26,6 +26,7 @@
|
||||
COUNT(*) OVER () AS total
|
||||
FROM (
|
||||
SELECT
|
||||
r.admin_seq AS adminSeq,
|
||||
h.seq AS householdSeq,
|
||||
h.household_num AS householdNum,
|
||||
h.owner_name AS householdName,
|
||||
@@ -179,6 +180,11 @@
|
||||
</if>
|
||||
</where>
|
||||
|
||||
<if test="cmd.userRole != null and cmd.userRole == 'ROLE_RESEARCHER'">
|
||||
/* 조사원일 경우 매핑된 임가만 노출 */
|
||||
AND hvr.adminSeq = #{cmd.adminSeq}
|
||||
</if>
|
||||
|
||||
ORDER BY hvr.householdNum ASC
|
||||
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
|
||||
</select>
|
||||
|
||||
@@ -42,25 +42,28 @@ let uiUtil = {
|
||||
curPageNo = parseInt(curPageNo);
|
||||
const firstPage = 0;
|
||||
|
||||
const isFirstPage = curPageNo === 0;
|
||||
let frag1 =
|
||||
`
|
||||
<div class="row">
|
||||
<nav class="component-pagination" aria-label="Page navigation example">
|
||||
|
||||
<a href="#" class="page-link pagination-item first"
|
||||
<a href="#" class="page-link pagination-item first ${isFirstPage ? 'disabled' : ''}""
|
||||
aria-label="First" data-target-page="${firstPage}">
|
||||
<span class="hide-txt">첫 페이지로 이동</span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="page-link pagination-item prev"
|
||||
<a href="#" class="page-link pagination-item prev ${isFirstPage ? 'disabled' : ''}""
|
||||
aria-label="Previous" data-target-page="${curPageNo === 0 ? null : curPageNo - 1}">
|
||||
<span class="hide-txt">이전 페이지로 이동</span>
|
||||
</a>
|
||||
`;
|
||||
|
||||
const pageSize = 10; // 보여줄 페이지 개수
|
||||
const safeTotalPages = totalPages > 0 ? totalPages : 1;
|
||||
|
||||
let startPage = Math.floor(curPageNo / pageSize) * pageSize; // 시작 페이지
|
||||
let endPage = Math.min(startPage + pageSize - 1, totalPages - 1); // 끝 페이지
|
||||
let endPage = Math.min(startPage + pageSize - 1, safeTotalPages - 1); // 끝 페이지
|
||||
|
||||
let frag2 = ``;
|
||||
for (let i = startPage; i <= endPage; i++) {
|
||||
@@ -75,13 +78,14 @@ let uiUtil = {
|
||||
}
|
||||
}
|
||||
|
||||
const isLastPage = curPageNo === totalPages - 1 || totalPages === 0;
|
||||
let frag3 =
|
||||
`
|
||||
<a href="#" class="page-link pagination-item next"
|
||||
<a href="#" class="page-link pagination-item next ${isLastPage ? 'disabled' : ''}""
|
||||
aria-label="Next" data-target-page="${curPageNo == totalPages - 1 || totalPages == 0 ? null : curPageNo + 1}">
|
||||
<span class="hide-txt">다음 페이지로 이동</span>
|
||||
</a>
|
||||
<a href="#" class="page-link pagination-item last"
|
||||
<a href="#" class="page-link pagination-item last ${isLastPage ? 'disabled' : ''}""
|
||||
aria-label="Last" data-target-page="${totalPages - 1}">
|
||||
<span class="hide-txt">마지막 페이지로 이동</span>
|
||||
</a>
|
||||
@@ -92,11 +96,18 @@ let uiUtil = {
|
||||
|
||||
let el = $(frag1 + frag2 + frag3);
|
||||
el.find('.page-link').on('click', (evt) => {
|
||||
let _this = evt.target;
|
||||
let targetPage = $(_this).data('target-page');
|
||||
const $link = $(evt.currentTarget);
|
||||
|
||||
if ($link.hasClass('disabled')) {
|
||||
evt.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetPage = $link.data('target-page');
|
||||
if (targetPage.toString() === 'null') {
|
||||
return false;
|
||||
}
|
||||
|
||||
moveHandler(targetPage);
|
||||
});
|
||||
|
||||
@@ -446,4 +457,9 @@ const ifNullDash = (value, fallback = '-') => {
|
||||
return value !== null && value !== undefined && value !== '' ? value : fallback;
|
||||
}
|
||||
|
||||
const formatNumberWithComma = (value) => {
|
||||
if (value == null || isNaN(value)) return '-';
|
||||
return Number(value).toLocaleString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -475,13 +475,110 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-content" data-tab-value="tab3">
|
||||
<div class="tab-content bank-auto-transfer" data-tab-value="tab3">
|
||||
<div class="content-inner">
|
||||
<div class="content-inner">
|
||||
<!-- 수입 -->
|
||||
<section class="table-group">
|
||||
<div class="table-tit-group">
|
||||
<h3>수입 <strong>(<span id="bankIncomeCount">0</span>건)</strong></h3>
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn small btn-secondary">
|
||||
<span class=" btn-txt">삭제</span>
|
||||
</button>
|
||||
<button type="button" class="btn small btn-primary">
|
||||
<span class="btn-txt">추가</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table-bank-income">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>선택</th>
|
||||
<th>재배형태</th>
|
||||
<th>수입의 종류</th>
|
||||
<th>대상</th>
|
||||
<th>수입원</th>
|
||||
<th>수량</th>
|
||||
<th>단위</th>
|
||||
<th>현금(원)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<!-- 지출 -->
|
||||
<section class="table-group">
|
||||
<div class="table-tit-group">
|
||||
<h3>지출 <strong>(<span id="bankExpenseCount">0</span>건)</strong></h3>
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn small btn-secondary">
|
||||
<span class=" btn-txt">삭제</span>
|
||||
</button>
|
||||
<button type="button" class="btn small btn-primary">
|
||||
<span class="btn-txt">추가</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table-bank-expense">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>선택</th>
|
||||
<th>지출의 종류</th>
|
||||
<th>용도</th>
|
||||
<th>수량</th>
|
||||
<th>단위</th>
|
||||
<th>현금(원)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-content" data-tab-value="tab4">
|
||||
<div class="tab-content household-visit" data-tab-value="tab4">
|
||||
<div class="content-inner">
|
||||
<section class="table-group">
|
||||
<div class="table-tit-group">
|
||||
<h3></h3>
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn small btn-secondary">
|
||||
<span class=" btn-txt">삭제</span>
|
||||
</button>
|
||||
<button type="button" class="btn small btn-primary">
|
||||
<span class="btn-txt">추가</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="household-visit">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>선택</th>
|
||||
<th>방문일</th>
|
||||
<th>관리분야</th>
|
||||
<th>내용</th>
|
||||
<th>최종 수정자</th>
|
||||
<th>답례품 전달</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -530,6 +627,12 @@
|
||||
className: 'gray'
|
||||
}
|
||||
};
|
||||
|
||||
const managementType = {
|
||||
VISIT: "방문조사",
|
||||
CALL: "전화상담",
|
||||
ETC: "기타"
|
||||
};
|
||||
</script>
|
||||
|
||||
<script>
|
||||
@@ -563,11 +666,11 @@
|
||||
break;
|
||||
case 'bank-auto-transfer': // 은행자동이체내역
|
||||
console.log("은행자동이체내역");
|
||||
// getAutoTransferStatus();
|
||||
getBankAutoTransfer();
|
||||
break;
|
||||
case 'household-visit': // 임가방문정보
|
||||
console.log("임가방문정보");
|
||||
// getVisitStatus();
|
||||
getVisitInfo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -649,7 +752,7 @@
|
||||
'/api/household/dailyRecordStatus',
|
||||
{ recordSeq: id },
|
||||
function(response) { // 성공
|
||||
console.log("일계부 등록 상세 데이터~ : ", response);
|
||||
console.log("일계부 등록 상세 데이터 : ", response);
|
||||
gridIncomeTable(response.status.incomeStatus, response.incomes);
|
||||
gridWorkTable(response.status.workStatus, response.works);
|
||||
gridExpenseTable(response.status.expenseStatus, response.expenses);
|
||||
@@ -672,7 +775,7 @@
|
||||
|
||||
$('#incomeCount').text(data.length);
|
||||
if(data.length === 0) {
|
||||
noData(tbody, status, 10);
|
||||
noDataDaily(tbody, status, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -690,13 +793,12 @@
|
||||
</td>
|
||||
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상판매 -->
|
||||
<td>${ifNullDash(item.cropText)}</td><!-- 재배형태 -->
|
||||
<!-- TODO(ks) : 수입의 종류 코드형태로 들어오고 있음, 텍스트형태로 바뀌는 건지 체크!! -->
|
||||
<td class="underline">${ifNullDash(item.categorySelf)}</td><!-- 수입의 종류 -->
|
||||
<td>${ifNullDash(item.sourcePurpose)}</td><!-- 수입원 -->
|
||||
<td class="align-right">${ifNullDash(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${ifNullDash(item.price)}</td><!-- 현금(원) -->
|
||||
<td class="align-right">${ifNullDash(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td>${item.unitSelf != null && item.unitSelf !== '' ? item.unitSelf : ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td>
|
||||
${item.updatedBy}<br>
|
||||
(${item.updatedAt})
|
||||
@@ -715,7 +817,7 @@
|
||||
|
||||
$('#workCount').text(data.length);
|
||||
if(data.length === 0) {
|
||||
noData(tbody, status, 18);
|
||||
noDataDaily(tbody, status, 18);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -764,7 +866,7 @@
|
||||
|
||||
$('#expenseCount').text(data.length);
|
||||
if(data.length === 0) {
|
||||
noData(tbody, status, 9);
|
||||
noDataDaily(tbody, status, 9);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -781,13 +883,12 @@
|
||||
</div>
|
||||
</td>
|
||||
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상 또는 카드구입 -->
|
||||
<!-- TODO(ks) : 지출의 종류 코드형태로 들어오고 있음, 텍스트형태로 바뀌는 건지 체크!! -->
|
||||
<td class="underline">${ifNullDash(item.categorySelf)}</td><!-- 지출의 종류 -->
|
||||
<td>${ifNullDash(item.sourcePurpose)}</td><!-- 용도 -->
|
||||
<td>${ifNullDash(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${ifNullDash(item.price)}</td><!-- 현금(원) -->
|
||||
<td class="align-right">${ifNullDash(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td>${item.unitSelf != null && item.unitSelf !== '' ? item.unitSelf : ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td>
|
||||
${item.updatedBy}<br>
|
||||
(${item.updatedAt})
|
||||
@@ -806,7 +907,7 @@
|
||||
|
||||
$('#powerCount').text(data.length);
|
||||
if(data.length === 0) {
|
||||
noData(tbody, status, 5);
|
||||
noDataDaily(tbody, status, 5);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -843,7 +944,7 @@
|
||||
|
||||
$('#forestryCount').text(data.length);
|
||||
if(data.length === 0) {
|
||||
noData(tbody, status, 7);
|
||||
noDataDaily(tbody, status, 7);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -863,7 +964,7 @@
|
||||
<td>${ifNullDash(item.usage)}</td><!-- 용도 -->
|
||||
<td class="align-right">${ifNullDash(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${ifNullDash(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td>
|
||||
${item.updatedBy}<br>
|
||||
(${item.updatedAt})
|
||||
@@ -882,7 +983,7 @@
|
||||
|
||||
$('#farmingCount').text(data.length);
|
||||
if(data.length === 0) {
|
||||
noData(tbody, status, 7);
|
||||
noDataDaily(tbody, status, 7);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -902,7 +1003,7 @@
|
||||
<td>${ifNullDash(item.usage)}</td><!-- 용도 -->
|
||||
<td class="align-right">${ifNullDash(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${ifNullDash(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td>
|
||||
${item.updatedBy}<br>
|
||||
(${item.updatedAt})
|
||||
@@ -916,6 +1017,7 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 임산물 현황 탭 조회
|
||||
const getForestProductsStatus = () => {
|
||||
const f = document.reqForm;
|
||||
|
||||
@@ -923,16 +1025,21 @@
|
||||
'/api/household/forestProducts',
|
||||
{
|
||||
householdSeq: f.householdSeq.value,
|
||||
month: f.recordMonth.value
|
||||
recordMonth: f.recordMonth.value
|
||||
},
|
||||
function(response) { // 성공
|
||||
(response) => { // 성공
|
||||
console.log("임산물 현황 리스트 조회 : ", response);
|
||||
const tbody = $('.tab-content.forest-product').find('tbody');
|
||||
const tbody = $('.tab-content.forest-product tbody');
|
||||
|
||||
tbody.empty();
|
||||
|
||||
if(response.forestProducts.length === 0) {
|
||||
noDataMonthly(tbody, response.status, 15);
|
||||
return;
|
||||
}
|
||||
|
||||
let tmpl = '';
|
||||
$(response).each((idx, item) => {
|
||||
$(response.forestProducts).each((idx, item) => {
|
||||
tmpl +=
|
||||
`
|
||||
<tr>
|
||||
@@ -973,12 +1080,172 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// nodata 처리
|
||||
const noData = (target, status, length) => {
|
||||
// 임가 방문정보 조회
|
||||
const getVisitInfo = () => {
|
||||
const f = document.reqForm;
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/household/visitInfos',
|
||||
{
|
||||
householdSeq: f.householdSeq.value,
|
||||
recordMonth: f.recordMonth.value
|
||||
},
|
||||
(response) => { // 성공
|
||||
console.log("임가 방문정보 조회 : ", response);
|
||||
const tbody = $('.tab-content.household-visit tbody');
|
||||
|
||||
tbody.empty();
|
||||
|
||||
if(response.length === 0) {
|
||||
tbody.append(`<tr><td colspan="6" style="text-align: center;">등록된 내용이 없습니다.</td></tr>`);
|
||||
return;
|
||||
}
|
||||
|
||||
let tmpl = '';
|
||||
$(response).each((idx, item) => {
|
||||
tmpl +=
|
||||
`
|
||||
<tr>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td>${ifNullDash(item.visitDate)}</td> <!-- 방문일 -->
|
||||
<td>${ifNullDash(managementType[item.managementType])}</td> <!-- 관리분야 -->
|
||||
<td>${ifNullDash(item.content)}</td> <!-- 내용 -->
|
||||
<td>
|
||||
${item.updatedBy}<br>
|
||||
(${item.updatedAt})
|
||||
</td><!-- 최종 수정자 -->
|
||||
<td>${item.isGiftSent ? "전달 완료" : "미전달"}</td> <!-- 답례품 전달 -->
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
tbody.append(tmpl);
|
||||
},
|
||||
function (code, rstData) { // 실패
|
||||
console.log("error : ", code);
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 은행자동이체내역 조회
|
||||
const getBankAutoTransfer = () => {
|
||||
const f = document.reqForm;
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/household/bankAutoTransfer',
|
||||
{
|
||||
householdSeq: f.householdSeq.value,
|
||||
recordMonth: f.recordMonth.value
|
||||
},
|
||||
(response) => { // 성공
|
||||
console.log("은행자동이체내역 조회 : ", response);
|
||||
gridBankIncomeTable(response.incomes);
|
||||
gridBankExpenseTable(response.expenses);
|
||||
},
|
||||
function (code, rstData) { // 실패
|
||||
console.log("error : ", code);
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
}
|
||||
|
||||
const gridBankIncomeTable = (data) => {
|
||||
const tbody = $('#table-bank-income tbody');
|
||||
tbody.empty();
|
||||
|
||||
$('#bankIncomeCount').text(data.length);
|
||||
if(data.length === 0) {
|
||||
tbody.append(`<tr><td colspan="8" style="text-align: center;">등록된 내용이 없습니다.</td></tr>`);
|
||||
return;
|
||||
}
|
||||
|
||||
let tmpl = '';
|
||||
$(data).each((idx, item) => {
|
||||
tmpl +=
|
||||
`
|
||||
<tr>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td>${ifNullDash(item.cropText)}</td> <!-- 재배형태 -->
|
||||
<td class="underline">${ifNullDash(item.categoryText)}</td> <!-- 수입의 종류 -->
|
||||
<td>${ifNullDash(item.categorySelf)}</td><!-- 대상 -->
|
||||
<td>${ifNullDash(item.sourcePurpose)}</td><!-- 수입원 -->
|
||||
<td>${ifNullDash(item.count)}</td><!-- 수량 -->
|
||||
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
tbody.append(tmpl);
|
||||
}
|
||||
|
||||
const gridBankExpenseTable = (data) => {
|
||||
const tbody = $('#table-bank-expense tbody');
|
||||
tbody.empty();
|
||||
|
||||
$('#bankExpenseCount').text(data.length);
|
||||
if(data.length === 0) {
|
||||
tbody.append(`<tr><td colspan="6" style="text-align: center;">등록된 내용이 없습니다.</td></tr>`);
|
||||
return;
|
||||
}
|
||||
|
||||
let tmpl = '';
|
||||
$(data).each((idx, item) => {
|
||||
tmpl +=
|
||||
`
|
||||
<tr>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td class="underline">${item.categorySelf != null && item.categorySelf !== '' ?
|
||||
item.categorySelf : ifNullDash(item.categoryText)}</td> <!-- 지출의 종류 -->
|
||||
<td>${ifNullDash(item.sourcePurpose)}</td><!-- 용도 -->
|
||||
<td>${ifNullDash(item.count)}</td><!-- 수량 -->
|
||||
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
tbody.append(tmpl);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 일계부 등록 현황 nodata 처리
|
||||
const noDataDaily = (target, status, length) => {
|
||||
const noDataText = status === 'TARGET' ? '등록이 필요합니다.' : '등록없음';
|
||||
|
||||
$(target).append(`<tr><td colspan="${length}" style="text-align: center;">${noDataText}</td></tr>`);
|
||||
}
|
||||
|
||||
// 임산물 현황 noData 처리
|
||||
const noDataMonthly = (target, status, length) => {
|
||||
const noDataText = status === 'NOTHING' ? '등록없음' : '등록이 필요합니다.';
|
||||
|
||||
$(target).append(`<tr><td colspan="${length}" style="text-align: center;">${noDataText}</td></tr>`);
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -118,17 +118,58 @@ VALUES
|
||||
|
||||
-- 재배형태
|
||||
('code.record.crop', 'code.record', '재배형태', NULL, NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.11', 'code.record.crop', '당년산/일반', '11', NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.12', 'code.record.crop', '당년산/유기농', '12', NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.13', 'code.record.crop', '당년산/무농약', '13', NULL, true, 2, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.15', 'code.record.crop', '당년산/GAP 인증', '15', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.11', 'code.record.crop', '당년산/ 일반', '11', NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.12', 'code.record.crop', '당년산 / 친환경 인증 / 유기농', '12', NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.13', 'code.record.crop', '당년산 / 친환경 인증 / 무농약', '13', NULL, true, 2, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.15', 'code.record.crop', '당년산 / GAP 인증', '15', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.21', 'code.record.crop', '전년산 / 일반', '21', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.22', 'code.record.crop', '전년산 / 친환경 인증 / 유기농', '22', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.23', 'code.record.crop', '전년산 / 친환경 인증 / 무농약', '23', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.24', 'code.record.crop', '전년산 / 친환경 인증 / 저농약', '24', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.crop.25', 'code.record.crop', '전년산 / GAP 인증', '25', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
|
||||
-- 단위 Code
|
||||
('code.record.unit', 'code.record', '단위 Code', NULL, NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.unit.gram', 'code.record.unit', 'g', 'g', NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.unit.kg', 'code.record.unit', 'kg', 'kg', NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
-- 면적
|
||||
('code.record.area', 'code.record', '면적', NULL, NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.area.11', 'code.record.area', '평', '평', NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.area.12', 'code.record.area', 'm2 (제곱미터)', 'm2', NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.area.13', 'code.record.area', 'ha (헥타르)', 'ha', NULL, true, 2, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.area.14', 'code.record.area', '정보', '정보', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.area.self', 'code.record.area', '직접 입력', 'SELF', NULL, true, 99, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
|
||||
-- 수확량(판매량) 단위
|
||||
('code.record.unit', 'code.record', '수확량(판매량) 단위', NULL, NULL, true, 2, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.unit.gram', 'code.record.unit', 'g (그램)', 'g', NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.unit.kg', 'code.record.unit', 'kg (킬로그램)', 'kg', NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.unit.13', 'code.record.unit', '근', '근', NULL, true, 2, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.unit.14', 'code.record.unit', '관', '관', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.unit.15', 'code.record.unit', 'L (리터)', 'L', NULL, true, 4, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.unit.16', 'code.record.unit', '되', '되', NULL, true, 5, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.unit.17', 'code.record.unit', '말', '말', NULL, true, 6, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.unit.18', 'code.record.unit', '섬', '섬', NULL, true, 7, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.unit.self', 'code.record.unit', '직접 입력', 'SELF', NULL, true, 99, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
|
||||
-- 자가농업 생산물 중 자가소비량
|
||||
('code.record.farming', 'code.record', '자가농업 생산물 중 자가소비량', NULL, NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.11', 'code.record.farming', '쌀', '12111,81012', NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.12', 'code.record.farming', '찹쌀', '12111,81012', NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.13', 'code.record.farming', '보리', '12111,81012', NULL, true, 2, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.14', 'code.record.farming', '콩', '12114,81012', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.15', 'code.record.farming', '팥', '12114,81012', NULL, true, 4, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.16', 'code.record.farming', '고구마', '12114,81012', NULL, true, 5, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.17', 'code.record.farming', '감자', '12114,81012', NULL, true, 6, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.18', 'code.record.farming', '배추', '12115,81012', NULL, true, 7, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.19', 'code.record.farming', '고추', '12115,81012', NULL, true, 8, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.20', 'code.record.farming', '마늘', '12115,81012', NULL, true, 9, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.21', 'code.record.farming', '양파', '12115,81012', NULL, true, 10, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.22', 'code.record.farming', '파', '12115,81012', NULL, true, 11, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.23', 'code.record.farming', '오이', '12115,81012', NULL, true, 12, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.24', 'code.record.farming', '무', '12115,81012', NULL, true, 13, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.25', 'code.record.farming', '김치', '12115,81012', NULL, true, 14, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.26', 'code.record.farming', '닭', '12122,81012', NULL, true, 15, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.27', 'code.record.farming', '달걀', '12123,81012', NULL, true, 16, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.28', 'code.record.farming', '과일', '12117,81012', NULL, true, 17, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.29', 'code.record.farming', '수수', '12113,81012', NULL, true, 18, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.30', 'code.record.farming', '기장', '12113,81012', NULL, true, 19, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.31', 'code.record.farming', '깨', '12116,81012', NULL, true, 20, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.farming.self', 'code.record.farming', '직접 입력', 'SELF', NULL, true, 99, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false);
|
||||
|
||||
-- 수입 종류
|
||||
('code.record.income', 'code.record', '단위 Code', NULL, NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.income.01', 'code.record.income', '종류1', '01', NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||
('code.record.income.02', 'code.record.income', '종류2', '02', NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false);
|
||||
|
||||
@@ -12,7 +12,6 @@ DROP TABLE IF EXISTS notice_has_upload_file;
|
||||
DROP TABLE IF EXISTS notice;
|
||||
|
||||
-- 조사원(관리자) 연관 테이블
|
||||
DROP TABLE IF EXISTS researcher_household_visit;
|
||||
DROP TABLE IF EXISTS researcher_has_household;
|
||||
DROP TABLE IF EXISTS researcher_has_area;
|
||||
DROP TABLE IF EXISTS research_area;
|
||||
@@ -64,6 +63,7 @@ DROP TABLE IF EXISTS front_user;
|
||||
-- household
|
||||
DROP TABLE IF EXISTS household_has_role;
|
||||
DROP TABLE IF EXISTS household;
|
||||
DROP TABLE IF EXISTS household_visit;
|
||||
|
||||
-- article
|
||||
DROP TABLE IF EXISTS article_has_upload_file;
|
||||
@@ -90,7 +90,6 @@ DROP SEQUENCE IF EXISTS address_seq;
|
||||
DROP SEQUENCE IF EXISTS input_day_group_seq;
|
||||
DROP SEQUENCE IF EXISTS operation_log_seq;
|
||||
|
||||
DROP SEQUENCE IF EXISTS researcher_household_visit_seq;
|
||||
DROP SEQUENCE IF EXISTS researcher_has_household_seq;
|
||||
DROP SEQUENCE IF EXISTS researcher_has_area_seq;
|
||||
DROP SEQUENCE IF EXISTS research_area_seq;
|
||||
@@ -119,6 +118,7 @@ DROP SEQUENCE IF EXISTS front_user_social_seq;
|
||||
|
||||
DROP SEQUENCE IF EXISTS household_seq;
|
||||
DROP SEQUENCE IF EXISTS household_has_role_seq;
|
||||
DROP SEQUENCE IF EXISTS household_visit_seq;
|
||||
|
||||
DROP SEQUENCE IF EXISTS article_seq;
|
||||
DROP SEQUENCE IF EXISTS article_comment_seq;
|
||||
|
||||
@@ -1008,48 +1008,47 @@ COMMENT ON COLUMN researcher_has_household.deleted_by IS '삭제자';
|
||||
COMMENT ON COLUMN researcher_has_household.is_deleted IS '삭제여부';
|
||||
|
||||
|
||||
-- 3. researcher_household_visit
|
||||
-- 3. household_visit
|
||||
-- ============================================
|
||||
-- TABLE : researcher_household_visit
|
||||
-- DESC : 조사원 임가 방문 정보 테이블
|
||||
-- TABLE : household_visit
|
||||
-- DESC : 임가 방문 정보 테이블
|
||||
-- ============================================
|
||||
CREATE SEQUENCE researcher_household_visit_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
||||
CREATE SEQUENCE household_visit_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
||||
|
||||
CREATE TABLE researcher_household_visit (
|
||||
id bigint DEFAULT nextval('researcher_household_visit_seq') NOT NULL, -- 조사원임가방문정보 ID (PK)
|
||||
admin_seq bigint NOT NULL, -- 관리자 일련번호 (조사원)
|
||||
household_seq bigint NOT NULL, -- 임가 일련번호
|
||||
is_gift_sent boolean, -- 답례품 전달 여부
|
||||
memo varchar(255), -- 메모
|
||||
visit_date date, -- 방문 날짜(yyyy-mm-dd)
|
||||
created_at timestamp(6), -- 생성일
|
||||
created_by varchar(255), -- 생성자
|
||||
updated_at timestamp(6), -- 수정일
|
||||
updated_by varchar(255), -- 수정자
|
||||
deleted_at timestamp(6), -- 삭제일
|
||||
deleted_by varchar(255), -- 삭제자
|
||||
is_deleted boolean DEFAULT false NOT NULL, -- 삭제 여부
|
||||
CREATE TABLE household_visit (
|
||||
id bigint DEFAULT nextval('household_visit_seq') NOT NULL, -- 조사원임가방문정보 ID (PK)
|
||||
household_seq bigint NOT NULL, -- 임가 일련번호
|
||||
management_type varchar(20) NOT NULL, -- 관리분야 (VISIT, CALL, ETC)
|
||||
is_gift_sent boolean, -- 답례품 전달 여부
|
||||
content varchar(255), -- 메모
|
||||
visit_date date, -- 방문 날짜(yyyy-mm-dd)
|
||||
created_at timestamp(6), -- 생성일
|
||||
created_by varchar(255), -- 생성자
|
||||
updated_at timestamp(6), -- 수정일
|
||||
updated_by varchar(255), -- 수정자
|
||||
deleted_at timestamp(6), -- 삭제일
|
||||
deleted_by varchar(255), -- 삭제자
|
||||
is_deleted boolean DEFAULT false NOT NULL, -- 삭제 여부
|
||||
|
||||
CONSTRAINT researcher_household_visit_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT fk_researcher_household_visit__admin FOREIGN KEY (admin_seq) REFERENCES admin(seq),
|
||||
CONSTRAINT fk_researcher_household_visit__household FOREIGN KEY (household_seq) REFERENCES household(seq)
|
||||
CONSTRAINT household_visit_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT fk_household_visit__household FOREIGN KEY (household_seq) REFERENCES household(seq)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE researcher_household_visit IS '조사원 임가 방문 정보 테이블';
|
||||
COMMENT ON TABLE household_visit IS '조사원 임가 방문 정보 테이블';
|
||||
|
||||
COMMENT ON COLUMN researcher_household_visit.id IS '조사원임가방문정보 ID';
|
||||
COMMENT ON COLUMN researcher_household_visit.admin_seq IS '관리자 일련번호(조사원)';
|
||||
COMMENT ON COLUMN researcher_household_visit.household_seq IS '임가 일련번호';
|
||||
COMMENT ON COLUMN researcher_household_visit.is_gift_sent IS '답례품 전달 여부';
|
||||
COMMENT ON COLUMN researcher_household_visit.memo IS '메모';
|
||||
COMMENT ON COLUMN researcher_household_visit.visit_date IS '방문날짜(yyyy-mm-dd)';
|
||||
COMMENT ON COLUMN researcher_household_visit.created_at IS '생성일';
|
||||
COMMENT ON COLUMN researcher_household_visit.created_by IS '생성자';
|
||||
COMMENT ON COLUMN researcher_household_visit.updated_at IS '수정일';
|
||||
COMMENT ON COLUMN researcher_household_visit.updated_by IS '수정자';
|
||||
COMMENT ON COLUMN researcher_household_visit.deleted_at IS '삭제일';
|
||||
COMMENT ON COLUMN researcher_household_visit.deleted_by IS '삭제자';
|
||||
COMMENT ON COLUMN researcher_household_visit.is_deleted IS '삭제여부';
|
||||
COMMENT ON COLUMN household_visit.id IS '조사원임가방문정보 ID';
|
||||
COMMENT ON COLUMN household_visit.household_seq IS '임가 일련번호';
|
||||
COMMENT ON COLUMN household_visit.management_type IS '관리분야 (VISIT, CALL, ETC)';
|
||||
COMMENT ON COLUMN household_visit.is_gift_sent IS '답례품 전달 여부';
|
||||
COMMENT ON COLUMN household_visit.content IS '내용';
|
||||
COMMENT ON COLUMN household_visit.visit_date IS '방문날짜(yyyy-mm-dd)';
|
||||
COMMENT ON COLUMN household_visit.created_at IS '생성일';
|
||||
COMMENT ON COLUMN household_visit.created_by IS '생성자';
|
||||
COMMENT ON COLUMN household_visit.updated_at IS '수정일';
|
||||
COMMENT ON COLUMN household_visit.updated_by IS '수정자';
|
||||
COMMENT ON COLUMN household_visit.deleted_at IS '삭제일';
|
||||
COMMENT ON COLUMN household_visit.deleted_by IS '삭제자';
|
||||
COMMENT ON COLUMN household_visit.is_deleted IS '삭제여부';
|
||||
|
||||
-- 조사원 연관 테이블 종료
|
||||
|
||||
|
||||
@@ -142,8 +142,10 @@ CREATE TABLE daily_income (
|
||||
id bigint DEFAULT nextval('daily_income_seq') NOT NULL, -- 일계부 수입 ID
|
||||
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
||||
input_type varchar(5), -- 입력 구분(SELF, OCR)
|
||||
income_mark varchar(10), -- 수입부호
|
||||
expense_mark varchar(10), -- 지출부호
|
||||
is_credit boolean, -- 외상판매 여부
|
||||
expense_mark_code varchar(10), -- 지출부호
|
||||
expense_mark_code varchar(10), -- 지출부호 TODO : 미사용 삭제하기
|
||||
crop_code varchar(255), -- 재배형태 코드 (매핑코드)
|
||||
category_code varchar(255), -- 수입 종류(매핑코드) TODO : 미사용 삭제하기
|
||||
category_self varchar(30), -- 수입 종류(직접입력)
|
||||
@@ -171,9 +173,9 @@ COMMENT ON COLUMN daily_income.id IS '일계부 수입 ID';
|
||||
COMMENT ON COLUMN daily_income.daily_record_seq IS '일계부 작성상태 일련번호';
|
||||
COMMENT ON COLUMN daily_income.input_type IS '입력 구분(SELF, OCR)';
|
||||
COMMENT ON COLUMN daily_income.is_credit IS '외상판매 여부';
|
||||
COMMENT ON COLUMN daily_income.expense_mark_code IS '지출부호';
|
||||
COMMENT ON COLUMN daily_income.income_mark IS '수입부호';
|
||||
COMMENT ON COLUMN daily_income.expense_mark IS '지출부호';
|
||||
COMMENT ON COLUMN daily_income.crop_code IS '재배형태 코드 (매핑코드)';
|
||||
COMMENT ON COLUMN daily_income.category_code IS '수입 종류(매핑코드)'; -- TODO : 미사용 삭제하기
|
||||
COMMENT ON COLUMN daily_income.category_self IS '수입 종류(직접입력)';
|
||||
COMMENT ON COLUMN daily_income.source_purpose IS '수입원(용도)';
|
||||
COMMENT ON COLUMN daily_income.quantity IS '수량';
|
||||
@@ -200,13 +202,15 @@ CREATE TABLE daily_expense (
|
||||
id bigint DEFAULT nextval('daily_expense_seq') NOT NULL, -- 일계부 지출 ID
|
||||
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
||||
input_type varchar(5), -- 입력 구분(SELF, OCR)
|
||||
income_mark varchar(10), -- 수입부호
|
||||
expense_mark varchar(10), -- 지출부호
|
||||
is_credit boolean, -- 외상판매 여부
|
||||
income_mark_code varchar(10), -- 수입부호 TODO : 수입종류와 다른것인지 판단 필요. 일단 다르다는 전제조건으로 생성
|
||||
income_mark_code varchar(10), -- 수입부호 TODO : 미사용 삭제하기
|
||||
category_code varchar(255), -- 수입 종류(매핑코드) TODO : 미사용 삭제하기
|
||||
category_self varchar(30), -- 수입 종류(직접입력)
|
||||
source_purpose varchar(10), -- 수입원(용도)
|
||||
quantity decimal(6,2), -- 수량
|
||||
unit_code varchar(255), -- 단위 (매핑코드)
|
||||
unit_code varchar(255), -- 단위(매핑코드)
|
||||
unit_self varchar(30), -- 단위(직접입력)
|
||||
price integer, -- 현금(원)
|
||||
estimated_value integer, -- 현물(평가액)
|
||||
@@ -227,9 +231,9 @@ COMMENT ON TABLE daily_expense IS '지출내역 - 일계부';
|
||||
COMMENT ON COLUMN daily_expense.id IS '일계부 지출 ID';
|
||||
COMMENT ON COLUMN daily_expense.daily_record_seq IS '일계부 작성상태 일련번호';
|
||||
COMMENT ON COLUMN daily_expense.input_type IS '입력 구분(SELF, OCR)';
|
||||
COMMENT ON COLUMN daily_expense.income_mark IS '수입부호';
|
||||
COMMENT ON COLUMN daily_expense.expense_mark IS '지출부호';
|
||||
COMMENT ON COLUMN daily_expense.is_credit IS '외상판매 여부';
|
||||
COMMENT ON COLUMN daily_expense.income_mark_code IS '수입부호';
|
||||
COMMENT ON COLUMN daily_expense.category_code IS '지출 종류(매핑코드)'; -- TODO : 미사용 삭제하기
|
||||
COMMENT ON COLUMN daily_expense.category_self IS '지출 종류(직접입력)';
|
||||
COMMENT ON COLUMN daily_expense.source_purpose IS '지출원(용도)';
|
||||
COMMENT ON COLUMN daily_expense.quantity IS '수량';
|
||||
@@ -255,13 +259,16 @@ CREATE SEQUENCE daily_work_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
||||
CREATE TABLE daily_work (
|
||||
id bigint DEFAULT nextval('daily_work_seq') NOT NULL,
|
||||
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
||||
income_mark varchar(10), -- 수입부호
|
||||
expense_mark varchar(10), -- 지출부호
|
||||
item_code varchar(255) NOT NULL,
|
||||
item_mark_code varchar(255),
|
||||
work_code varchar(255) NOT NULL,
|
||||
work_mark_code varchar(255),
|
||||
work_land_area int,
|
||||
harvest_quantity decimal(7,2),
|
||||
unit_code varchar(10),
|
||||
unit_code varchar(255),
|
||||
unit_self varchar(30), -- 단위(직접입력)
|
||||
owner_time decimal(5,2), -- 경영주 노동시간
|
||||
spouse_time decimal(5,2), -- 배우자 노동시간
|
||||
family_m_hours decimal(5,2), -- 가족 남 노동시간
|
||||
@@ -288,13 +295,16 @@ COMMENT ON TABLE daily_work IS '임업노동 투입내역 - 일계부';
|
||||
|
||||
COMMENT ON COLUMN daily_work.id IS '투입내역 내부키';
|
||||
COMMENT ON COLUMN daily_work.daily_record_seq IS '일계부 작성상태 일련번호';
|
||||
COMMENT ON COLUMN daily_work.income_mark IS '수입부호';
|
||||
COMMENT ON COLUMN daily_work.expense_mark IS '지출부호';
|
||||
COMMENT ON COLUMN daily_work.item_code IS '품목명 (매핑코드)';
|
||||
COMMENT ON COLUMN daily_work.item_mark_code IS '품목부호 (매핑코드)';
|
||||
COMMENT ON COLUMN daily_work.work_code IS '작업명 (매핑코드)';
|
||||
COMMENT ON COLUMN daily_work.work_mark_code IS '작업부호 (매핑코드)';
|
||||
COMMENT ON COLUMN daily_work.work_land_area IS '작업면적';
|
||||
COMMENT ON COLUMN daily_work.harvest_quantity IS '수확량';
|
||||
COMMENT ON COLUMN daily_work.unit_code IS '단위 (코드매핑)';
|
||||
COMMENT ON COLUMN daily_work.unit_code IS '단위(코드매핑)';
|
||||
COMMENT ON COLUMN daily_work.unit_self IS '단위(직접입력)';
|
||||
COMMENT ON COLUMN daily_work.owner_time IS '경영주 노동시간';
|
||||
COMMENT ON COLUMN daily_work.spouse_time IS '배우자 노동시간';
|
||||
COMMENT ON COLUMN daily_work.family_m_hours IS '가족 남 노동시간';
|
||||
@@ -366,6 +376,8 @@ CREATE SEQUENCE daily_power_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
||||
CREATE TABLE daily_power (
|
||||
id bigint DEFAULT nextval('daily_power_seq') NOT NULL, -- 동력사용시간 ID
|
||||
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
||||
income_mark varchar(10), -- 수입부호
|
||||
expense_mark varchar(10), -- 지출부호
|
||||
equipment_name varchar(15), -- 명칭
|
||||
owned_mark_code varchar(255), -- 자가 부호 (매핑코드) TODO : 명칭 >> 자가로 변경
|
||||
owned_hours decimal(5,2), -- 자가 시간
|
||||
@@ -385,7 +397,9 @@ CREATE TABLE daily_power (
|
||||
COMMENT ON TABLE daily_power IS '동력 사용시간 - 일계부';
|
||||
|
||||
COMMENT ON COLUMN daily_power.id IS '동력사용시간 ID';
|
||||
COMMENT ON COLUMN daily_income.daily_record_seq IS '일계부 작성상태 일련번호';
|
||||
COMMENT ON COLUMN daily_power.daily_record_seq IS '일계부 작성상태 일련번호';
|
||||
COMMENT ON COLUMN daily_power.income_mark IS '수입부호';
|
||||
COMMENT ON COLUMN daily_power.expense_mark IS '지출부호';
|
||||
COMMENT ON COLUMN daily_power.equipment_name IS '명칭';
|
||||
COMMENT ON COLUMN daily_power.owned_mark_code IS '자가 부호 (매핑코드)';
|
||||
COMMENT ON COLUMN daily_power.owned_hours IS '자가 시간';
|
||||
@@ -408,12 +422,15 @@ CREATE SEQUENCE daily_forestry_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
||||
CREATE TABLE daily_forestry (
|
||||
id bigint DEFAULT nextval('daily_forestry_seq') NOT NULL, -- 임업 자가소비량 일련번호
|
||||
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
||||
income_code varchar(255), -- 수입 코드 (매핑코드) TODO : 필요유무
|
||||
expense_code varchar(255), -- 지출 코드 (매핑코드) TODO : 필요유무
|
||||
income_mark varchar(10), -- 수입부호
|
||||
expense_mark varchar(10), -- 지출부호
|
||||
income_code varchar(255), -- 수입 코드 (매핑코드) TODO : 미사용 삭제
|
||||
expense_code varchar(255), -- 지출 코드 (매핑코드) TODO : 미사용 삭제
|
||||
product_name varchar(15), -- 생산물
|
||||
usage varchar(20), -- 용도
|
||||
quantity decimal(6,2), -- 수량
|
||||
unit_code varchar(10), -- 단위 (매핑코드)
|
||||
unit_code varchar(255), -- 단위(매핑코드)
|
||||
unit_self varchar(30), -- 단위(직접입력)
|
||||
estimated_value integer, -- 현물평가
|
||||
created_at timestamp(6), -- 생성일
|
||||
created_by varchar(255), -- 생성자
|
||||
@@ -431,12 +448,13 @@ COMMENT ON TABLE daily_forestry IS '자가임업 생산물 중 자가소비량';
|
||||
|
||||
COMMENT ON COLUMN daily_forestry.id IS '임가 일련번호';
|
||||
COMMENT ON COLUMN daily_forestry.daily_record_seq IS '일계부 작성상태 일련번호';
|
||||
COMMENT ON COLUMN daily_forestry.income_code IS '수입 코드(매핑코드)';
|
||||
COMMENT ON COLUMN daily_forestry.expense_code IS '지출 코드(매핑코드)';
|
||||
COMMENT ON COLUMN daily_forestry.income_mark IS '수입부호';
|
||||
COMMENT ON COLUMN daily_forestry.expense_mark IS '지출부호';
|
||||
COMMENT ON COLUMN daily_forestry.product_name IS '생산물';
|
||||
COMMENT ON COLUMN daily_forestry.usage IS '용도';
|
||||
COMMENT ON COLUMN daily_forestry.quantity IS '수량';
|
||||
COMMENT ON COLUMN daily_forestry.unit_code IS '단위(매핑코드)';
|
||||
COMMENT ON COLUMN daily_forestry.unit_self IS '단위(직접입력)';
|
||||
COMMENT ON COLUMN daily_forestry.estimated_value IS '현물평가';
|
||||
COMMENT ON COLUMN daily_forestry.created_at IS '생성일';
|
||||
COMMENT ON COLUMN daily_forestry.created_by IS '생성자';
|
||||
@@ -458,13 +476,16 @@ CREATE TABLE daily_farming (
|
||||
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
||||
week_date date, -- 입력차수일(yyyy-mm-dd)
|
||||
week smallint, -- 입력차수(1,2,3,4)
|
||||
income_code varchar(255), -- 수입 코드 (매핑코드) TODO : 필요유무
|
||||
expense_code varchar(255), -- 지출 코드 (매핑코드) TODO : 필요유무
|
||||
income_mark varchar(10), -- 수입부호
|
||||
expense_mark varchar(10), -- 지출부호
|
||||
income_code varchar(255), -- 수입 코드 (매핑코드) TODO : 미사용 삭제하기
|
||||
expense_code varchar(255), -- 지출 코드 (매핑코드) TODO : 미사용 삭제하기
|
||||
product_name varchar(15), -- 생산물
|
||||
product_detail varchar(20), -- 생산물 상세 TODO : 필요유무
|
||||
usage varchar(20), -- 용도
|
||||
quantity decimal(6,2), -- 수량
|
||||
unit_code varchar(10), -- 단위 (매핑코드)
|
||||
unit_code varchar(255), -- 단위 (매핑코드)
|
||||
unit_self varchar(30), -- 단위(직접입력)
|
||||
estimated_value integer, -- 현물평가액
|
||||
created_at timestamp(6), -- 생성일
|
||||
created_by varchar(255), -- 생성자
|
||||
@@ -483,13 +504,14 @@ COMMENT ON TABLE daily_farming IS '자가농업 생산물 중 자가소비량';
|
||||
COMMENT ON COLUMN daily_farming.id IS '농업 자가소비량 내부키';
|
||||
COMMENT ON COLUMN daily_farming.week_date IS '입력차수일';
|
||||
COMMENT ON COLUMN daily_farming.week IS '입력차수(1,2,3,4)';
|
||||
COMMENT ON COLUMN daily_farming.income_code IS '수입 코드(매핑코드)';
|
||||
COMMENT ON COLUMN daily_farming.expense_code IS '지출 코드(매핑코드)';
|
||||
COMMENT ON COLUMN daily_farming.income_mark IS '수입부호';
|
||||
COMMENT ON COLUMN daily_farming.expense_mark IS '지출부호';
|
||||
COMMENT ON COLUMN daily_farming.product_name IS '생산물';
|
||||
COMMENT ON COLUMN daily_farming.product_detail IS '생산물 상세';
|
||||
COMMENT ON COLUMN daily_farming.usage IS '용도';
|
||||
COMMENT ON COLUMN daily_farming.quantity IS '수량';
|
||||
COMMENT ON COLUMN daily_farming.unit_code IS '단위(매핑코드)';
|
||||
COMMENT ON COLUMN daily_farming.unit_self IS '단위(직접입력)';
|
||||
COMMENT ON COLUMN daily_farming.estimated_value IS '현물평가';
|
||||
COMMENT ON COLUMN daily_farming.created_at IS '생성일';
|
||||
COMMENT ON COLUMN daily_farming.created_by IS '생성자';
|
||||
|
||||
@@ -74,9 +74,10 @@ GROUP BY rhh.household_seq;
|
||||
-- ============================================
|
||||
CREATE VIEW v_household_researcher AS
|
||||
SELECT
|
||||
rhh.household_seq,
|
||||
a.name AS researcher_name,
|
||||
a.phone AS researcher_phone
|
||||
a.seq AS admin_seq,
|
||||
rhh.household_seq AS household_seq,
|
||||
a.name AS researcher_name,
|
||||
a.phone AS researcher_phone
|
||||
FROM researcher_has_household rhh
|
||||
JOIN admin a ON rhh.admin_seq = a.seq
|
||||
WHERE rhh.is_deleted = false;
|
||||
@@ -94,9 +94,10 @@ public class DailyExpenseService implements DailyExpensePortIn {
|
||||
new CreateDailyExpenseCmd(
|
||||
formVO.getId(),
|
||||
formVO.getDailyRecordSeq(),
|
||||
(formVO.getCredit() ? "52210" : null), // [정책] 외상판매 Y 일 경우 수입부호 52210 적재
|
||||
null,
|
||||
formVO.getInputType(),
|
||||
formVO.getCredit(),
|
||||
(formVO.getCredit() ? "52210" : null), // [정책] 외상판매 Y 일 경우 수입부호 52210 적재
|
||||
formVO.getCategorySelf(),
|
||||
formVO.getSourcePurpose(),
|
||||
formVO.getQuantity(),
|
||||
|
||||
@@ -13,9 +13,10 @@ import lombok.ToString;
|
||||
public class CreateDailyExpenseCmd extends FrontAuditCommand {
|
||||
private Long id;
|
||||
private Long dailyRecordSeq;
|
||||
private String incomeMark;
|
||||
private String expenseMark;
|
||||
private String inputType;
|
||||
private Boolean credit;
|
||||
private String incomeMarkCode;
|
||||
private String categorySelf;
|
||||
private String sourcePurpose;
|
||||
private Integer quantity;
|
||||
|
||||
@@ -97,10 +97,11 @@ public class DailyIncomeService implements DailyIncomePortIn {
|
||||
new CreateDailyIncomeCmd(
|
||||
formVO.getId(),
|
||||
formVO.getDailyRecordSeq(),
|
||||
null,
|
||||
(formVO.getCredit() ? "91206" : null), // [정책] 외상판매 Y 일 경우 지출부호 91206 적재
|
||||
formVO.getInputType(),
|
||||
formVO.getCredit(),
|
||||
formVO.getCropCode(),
|
||||
(formVO.getCredit() ? "91206" : null), // [정책] 외상판매 Y 일 경우 지출부호 91206 적재
|
||||
formVO.getCategorySelf(),
|
||||
formVO.getSourcePurpose(),
|
||||
formVO.getQuantity(),
|
||||
|
||||
@@ -13,10 +13,11 @@ import lombok.ToString;
|
||||
public class CreateDailyIncomeCmd extends FrontAuditCommand {
|
||||
private Long id;
|
||||
private Long dailyRecordSeq;
|
||||
private String incomeMark;
|
||||
private String expenseMark;
|
||||
private String inputType;
|
||||
private Boolean credit;
|
||||
private String cropCode;
|
||||
private String expenseMarkCode;
|
||||
private String categorySelf;
|
||||
private String sourcePurpose;
|
||||
private Integer quantity;
|
||||
|
||||
@@ -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.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
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.application.domain.GetMonthlyInputStatus;
|
||||
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.application.domain.GetPrevMonthlyInputStatus;
|
||||
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 org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
@@ -29,13 +35,14 @@ class GetBankInputUIController {
|
||||
|
||||
private final GetPrevMonthlyInputStatusPortIn prevMonthlyInputStatusPortIn;
|
||||
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
||||
|
||||
private final GetBanksPortIn getBanksPortIn;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
|
||||
|
||||
@GetMapping(path = "/info/bank/create/input/{id}")
|
||||
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"));
|
||||
|
||||
@@ -54,6 +61,22 @@ class GetBankInputUIController {
|
||||
new GetMonthlyInputStatusCmd(
|
||||
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");
|
||||
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth(), formatter);
|
||||
@@ -66,6 +89,11 @@ class GetBankInputUIController {
|
||||
model.addAttribute("pastMonthlyInfo", pastMonthlyInfo);
|
||||
model.addAttribute("currentMonthlyInfo", currentMonthlyInfo);
|
||||
|
||||
|
||||
model.addAttribute("pastBankList", pastList);
|
||||
model.addAttribute("bankList", currentList);
|
||||
|
||||
|
||||
model.addAttribute("transferCategoryList", uiCodeListPortIn.connect("code.bank.input"));
|
||||
model.addAttribute("codeRecordCropList", uiCodeListPortIn.connect("code.record.crop"));
|
||||
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();
|
||||
|
||||
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
|
||||
@AllArgsConstructor
|
||||
public class RemoveMonthForestProductsParam {
|
||||
private Long id;
|
||||
private Long monthlyInputStatusId;
|
||||
private Long householdSeq;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
|
||||
@@ -10,6 +10,6 @@ import lombok.Setter;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class RemoveMonthForestProductsCmd {
|
||||
private Long id;
|
||||
private Long monthlyInputStatusId;
|
||||
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>
|
||||
@@ -29,13 +29,14 @@
|
||||
|
||||
<insert id="createDailyExpense" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into daily_expense (
|
||||
daily_record_seq, input_type, is_credit, income_mark_code, category_self, source_purpose
|
||||
daily_record_seq, income_mark, expense_mark
|
||||
, input_type, is_credit, category_self, source_purpose
|
||||
, quantity, unit_code, unit_self, price, estimated_value
|
||||
, is_deleted
|
||||
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
) values (
|
||||
#{dailyRecordSeq}
|
||||
, #{inputType}, #{credit}, #{incomeMarkCode}, #{categorySelf}, #{sourcePurpose}
|
||||
#{dailyRecordSeq}, #{incomeMark}, #{expenseMark}
|
||||
, #{inputType}, #{credit}, #{categorySelf}, #{sourcePurpose}
|
||||
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
|
||||
, false
|
||||
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
@@ -45,7 +46,8 @@
|
||||
<update id="updateDailyExpense">
|
||||
update daily_expense set <include refid="common.fields.UpdateBaseSet"/>
|
||||
, is_credit = #{credit}
|
||||
, income_mark_code = #{incomeMarkCode}
|
||||
, income_mark = #{incomeMark}
|
||||
, expense_mark = #{expenseMark}
|
||||
, category_self = #{categorySelf}
|
||||
, source_purpose = #{sourcePurpose}
|
||||
, quantity = #{quantity}
|
||||
|
||||
@@ -29,13 +29,14 @@
|
||||
|
||||
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into daily_income (
|
||||
daily_record_seq, input_type, is_credit, expense_mark_code, crop_code, category_self, source_purpose
|
||||
daily_record_seq, income_mark, expense_mark
|
||||
, input_type, is_credit, crop_code, category_self, source_purpose
|
||||
, quantity, unit_code, unit_self, price, estimated_value
|
||||
, is_deleted
|
||||
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
) values (
|
||||
#{dailyRecordSeq}
|
||||
, #{inputType}, #{credit}, #{expenseMarkCode}, #{cropCode}, #{categorySelf}, #{sourcePurpose}
|
||||
#{dailyRecordSeq}, #{incomeMark}, #{expenseMark}
|
||||
, #{inputType}, #{credit}, #{cropCode}, #{categorySelf}, #{sourcePurpose}
|
||||
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
|
||||
, false
|
||||
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
@@ -45,7 +46,8 @@
|
||||
<update id="updateDailyIncome">
|
||||
update daily_income set <include refid="common.fields.UpdateBaseSet"/>
|
||||
, is_credit = #{credit}
|
||||
, expense_mark_code = #{expenseMarkCode}
|
||||
, income_mark = #{incomeMark}
|
||||
, expense_mark = #{expenseMark}
|
||||
, crop_code = #{cropCode}
|
||||
, category_self = #{categorySelf}
|
||||
, source_purpose = #{sourcePurpose}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<insert id="createForestProduct" keyProperty="id">
|
||||
<!-- createForestProduct 게시글 등록 -->
|
||||
<selectKey keyProperty="id" order="BEFORE" resultType="long">
|
||||
SELECT nextval('notice_seq')
|
||||
SELECT nextval('monthly_input_status_seq')
|
||||
</selectKey>
|
||||
|
||||
INSERT INTO forest_product (
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
SET <include refid="common.fields.DeleteBaseSet" />
|
||||
WHERE
|
||||
household_seq = #{householdSeq}
|
||||
AND monthly_input_status_id = #{id}
|
||||
AND monthly_input_status_id = #{monthlyInputStatusId}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
<meta name="_csrf" th:content="${_csrf.token}"/>
|
||||
<meta name="_csrf_header" th:content="${_csrf.headerName}"/>
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="pathImages/" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="pathImages/" />
|
||||
<link rel="icon" type="image/x-icon" /><!-- TODO : href="pathImages/" -->
|
||||
<link rel="shortcut icon" type="image/x-icon" /><!-- TODO : href="pathImages/" -->
|
||||
<link th:href="@{/static/assets/styles/style.css}" type="text/css" rel="stylesheet" />
|
||||
<script th:src="@{/static/assets/scripts/common.ui.plugin.js}"></script>
|
||||
<script th:src="@{/static/assets/scripts/common.ui.js}" data-init></script>
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<div class="component-btns fixed">
|
||||
<div class="btns-row">
|
||||
<!-- 비활성화 스타일/ 버튼 속성 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>
|
||||
</button>
|
||||
</div>
|
||||
@@ -97,7 +97,7 @@
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>"/api/front/info/bank/create"
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
@@ -111,11 +111,11 @@
|
||||
modalPopup: null
|
||||
},
|
||||
data: {
|
||||
transferCategoryList: /*[[${transferCategoryList}]]*/ [],
|
||||
transferCategoryCodeList: /*[[${transferCategoryList}]]*/ [],
|
||||
codeRecordCropList: /*[[${codeRecordCropList}]]*/ [],
|
||||
unitList: /*[[${unitList}]]*/ [],
|
||||
bankList : [],
|
||||
pastBankList : [],
|
||||
bankList : /*[[${bankList.content}]]*/ [],
|
||||
pastBankList : /*[[${pastBankList.content}]]*/ [],
|
||||
id: /*[[${currentMonthlyInfo.id}]]*/'',
|
||||
currentStatus: /*[[${currentMonthlyInfo.bankAutoTransferInputStatus}]]*/'',
|
||||
pastStatus: /*[[${pastMonthlyInfo?.bankAutoTransferInputStatus}]]*/'',
|
||||
@@ -125,7 +125,7 @@
|
||||
noDataCheckbox: document.getElementById("forestProductStatus"),
|
||||
select:{
|
||||
cropCodeSelect : null,
|
||||
transferCategorySelect : null,
|
||||
transferCategoryCodeSelect : null,
|
||||
unitCodeSelect : null,
|
||||
}
|
||||
},
|
||||
@@ -247,11 +247,12 @@
|
||||
}
|
||||
});
|
||||
|
||||
const $select2 = document.querySelector('#transferCategorySelect');
|
||||
ENV.elementRefs.select.transferCategorySelect = new etUI.components.SelectBox();
|
||||
ENV.elementRefs.select.transferCategorySelect.core.init($select2,{
|
||||
const $select2 = document.querySelector('#transferCategoryCodeSelect');
|
||||
ENV.elementRefs.select.transferCategoryCodeSelect = new etUI.components.SelectBox();
|
||||
ENV.elementRefs.select.transferCategoryCodeSelect.core.init($select2,{
|
||||
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 => {
|
||||
el.style.display = 'none';
|
||||
});
|
||||
@@ -327,17 +328,17 @@
|
||||
|
||||
const form = document.getElementById('popupForm');
|
||||
kri.form.errorInit(form);
|
||||
const selects = ['cropCode', 'transferCategory', 'unitCode'];
|
||||
const selects = ['cropCode', 'transferCategoryCode', 'unitCode'];
|
||||
selects.forEach(id => {
|
||||
const sel = document.getElementById(id + 'Select');
|
||||
if (sel && sel.value) form[id].value = sel.value;
|
||||
});
|
||||
|
||||
const errors = [];
|
||||
if (!form.transferCategory.value) errors.push({field: 'transferCategory', message: '수입종류를 선택해주세요.'});
|
||||
if (form.transferCategory.value && document.getElementById(form.transferCategory.value+"_value")
|
||||
&& !document.getElementById(form.transferCategory.value+"_value").value){
|
||||
errors.push({field: form.transferCategory.value+"_value", message: '수입대상을 입력해주세요.'});
|
||||
if (!form.transferCategoryCode.value) errors.push({field: 'transferCategoryCode', message: '수입종류를 선택해주세요.'});
|
||||
if (form.transferCategoryCode.value && document.getElementById(form.transferCategoryCode.value+"_value")
|
||||
&& !document.getElementById(form.transferCategoryCode.value+"_value").value){
|
||||
errors.push({field: form.transferCategoryCode.value+"_value", message: '수입대상을 입력해주세요.'});
|
||||
}
|
||||
if (!form.sourcePurpose.value) errors.push({field: 'sourcePurpose', message: '수입원을 입력해주세요.'});
|
||||
|
||||
@@ -352,6 +353,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
form.transferCategory.value = document.getElementById(form.transferCategoryCode.value+"_value").value;//입력값
|
||||
const formData = new FormData(form);
|
||||
const product = {};
|
||||
formData.forEach((value, key) => product[key] = value);
|
||||
@@ -366,7 +368,7 @@
|
||||
},
|
||||
|
||||
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 : '-';
|
||||
},
|
||||
// 단위 코드
|
||||
@@ -392,11 +394,16 @@
|
||||
|
||||
Object.entries(product).forEach(([key, val]) => {
|
||||
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.transferCategorySelect.setValue(product.transferCategory);
|
||||
ENV.elementRefs.select.transferCategoryCodeSelect.setValue(product.transferCategoryCode);
|
||||
ENV.elementRefs.select.unitCodeSelect.setValue(product.unitCode);
|
||||
},100)
|
||||
|
||||
@@ -412,6 +419,29 @@
|
||||
clearAllItems() {
|
||||
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 getCrop = formControl.getCropLabel;
|
||||
|
||||
const categoryCode = product.transferCategory;
|
||||
const categoryValue = product[`${categoryCode}_value`];
|
||||
const categoryCode = product.transferCategoryCode;
|
||||
const categoryCodeInputValue = product.transferCategory;
|
||||
const categoryValue = product[`${categoryCode}_value`] ? product[`${categoryCode}_value`] : categoryCodeInputValue;
|
||||
const tagTitle = categoryCode === 'code.bank.input.99'
|
||||
? categoryValue
|
||||
: `${getCategory(categoryCode)}<span>(${categoryValue})</span>`;
|
||||
|
||||
@@ -57,8 +57,9 @@
|
||||
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
||||
</p>
|
||||
</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">
|
||||
<input type="hidden" name="transferCategoryCode" id="transferCategoryCode" data-type="select"/>
|
||||
<input type="hidden" name="transferCategory" id="transferCategory" data-type="select"/>
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
|
||||
@@ -410,10 +410,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
new DatepickerComponent(function(list, currentDate, viewDate){
|
||||
console.log('changeDateCallback', list, currentDate, viewDate);
|
||||
new DatepickerComponent(function(rowdata, currentDate, viewDate){
|
||||
console.log('changeDateCallback', rowdata, currentDate, viewDate);
|
||||
|
||||
formControl.setDetail(list, currentDate, viewDate);
|
||||
formControl.setDetail(this.currentMonth, rowdata, currentDate, viewDate);
|
||||
|
||||
}, function(monthKey, currentDate){
|
||||
console.log('changeMonthCallback', monthKey, currentDate);
|
||||
@@ -445,9 +445,14 @@
|
||||
};
|
||||
|
||||
let formControl = {
|
||||
setDetail(list, currentDate, viewDate) {
|
||||
const todoList = list.filter(f => !(f.code === 'MONTHLY' || f.code === 'BANK'));
|
||||
const etcList = list.filter(f => f.code === 'MONTHLY' || f.code === 'BANK');
|
||||
setDetail(searchMonth, rowdata, currentDate, viewDate) {
|
||||
console.log(typeof rowdata, searchMonth, rowdata.no, rowdata.children)
|
||||
let todoList = [];
|
||||
let etcList = [];
|
||||
if (typeof rowdata === 'object' && rowdata.children !== undefined) {
|
||||
todoList = rowdata.children.filter(f => !(f.code === 'MONTHLY' || f.code === 'BANK'));
|
||||
etcList = rowdata.children.filter(f => f.code === 'MONTHLY' || f.code === 'BANK');
|
||||
}
|
||||
console.log(todoList)
|
||||
console.log(etcList)
|
||||
|
||||
@@ -455,23 +460,26 @@
|
||||
let html = '';
|
||||
if (todoList === undefined || todoList.length === 0) {
|
||||
html = tmpl.render({
|
||||
month: searchMonth,
|
||||
no: rowdata.no,
|
||||
date: currentDate,
|
||||
etcList: etcList,
|
||||
});
|
||||
} else {
|
||||
tmpl = $.templates('#dailyListTmpl');
|
||||
html = tmpl.render({
|
||||
month: searchMonth,
|
||||
no: rowdata.no,
|
||||
date: currentDate,
|
||||
list: todoList,
|
||||
etcList: etcList,
|
||||
});
|
||||
}
|
||||
console.log(html)
|
||||
|
||||
$('#selectedDay').html(html);
|
||||
},
|
||||
recordCreate(searchMonth, groupNo) {
|
||||
location.href = ENV.httpUrl.create.replace('{searchMonth}', searchMonth).replace('{groupNo}', groupNo);
|
||||
location.href = ENV.httpUrl.create.replace('{searchMonth}', searchMonth.replace('-', '')).replace('{groupNo}', groupNo);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -479,7 +487,7 @@
|
||||
{{include tmpl="#titleTmpl" /}}
|
||||
|
||||
<div class="component-btns btn-add">
|
||||
<button type="button" onclick="alert('TODO');">
|
||||
<button type="button" onclick="formControl.recordCreate('{{:month}}', {{:no}});">
|
||||
<p class="txt">일계부 등록하기</p>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<!--/*<div class="component-input">
|
||||
<label class="switch-inner type-txt">
|
||||
<span class="switch-label">임업노동 투입 내역</span>
|
||||
<input type="checkbox" name="workStatus" value="TARGET" data-target="work"
|
||||
@@ -49,7 +49,7 @@
|
||||
<span class="switch-handle"></span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>*/-->
|
||||
<div class="component-input">
|
||||
<label class="switch-inner type-txt">
|
||||
<span class="switch-label">지출</span>
|
||||
@@ -60,7 +60,7 @@
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<!--/*<div class="component-input">
|
||||
<label class="switch-inner type-txt">
|
||||
<span class="switch-label">동력 사용시간</span>
|
||||
<input type="checkbox" name="powerStatus" value="TARGET" data-target="power"
|
||||
@@ -79,9 +79,9 @@
|
||||
<span class="switch-handle"></span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>*/-->
|
||||
<!--/* [정책] 자가농업 생산물 중 자가소비량은 7일차 등록일에만 노출 및 선택, 21일 이후는 마지막 날 */-->
|
||||
<div class="component-input"
|
||||
<!--/*<div class="component-input"
|
||||
th:if="${reqVO.groupNo eq 4 or reqVO.groupNo eq 8 or reqVO.groupNo eq 12
|
||||
or reqVO.groupNo eq 16 or reqVO.groupNo eq 17}">
|
||||
<label class="switch-inner type-txt">
|
||||
@@ -92,7 +92,7 @@
|
||||
<span class="switch-handle"></span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>*/-->
|
||||
</section>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -179,9 +179,11 @@
|
||||
$('input[name="unitCode"]').val(dataValue)
|
||||
|
||||
// TODO : ui js 에서 show 적용유무 파악하기
|
||||
/*
|
||||
if (dataValue === 'code.record.unit.self') {
|
||||
$('#unitCode').parent().find('.component-input').addClass('show');
|
||||
}
|
||||
*/
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user