Merge branch 'susu' into dev
This commit is contained in:
@@ -26,7 +26,6 @@ public class UpdateNoticeReqVO {
|
|||||||
@NotNull(message = "노출여부는 {valid.common.required}")
|
@NotNull(message = "노출여부는 {valid.common.required}")
|
||||||
private Boolean visible;
|
private Boolean visible;
|
||||||
|
|
||||||
|
|
||||||
@NotNull(message = "시작일은 {valid.common.required}")
|
@NotNull(message = "시작일은 {valid.common.required}")
|
||||||
private LocalDateTime startDate;
|
private LocalDateTime startDate;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.adapters.persistence;
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.adapters.persistence;
|
||||||
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetDailyRecords;
|
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.*;
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholds;
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetVisitInfos;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholdsExcelCmd;
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.GetHouseholdsExcelPortOut;
|
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.GetHouseholdsExcelPortOut;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@@ -28,4 +25,29 @@ class GetHouseholdsExcelDao implements GetHouseholdsExcelPortOut {
|
|||||||
public List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd) {
|
public List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd) {
|
||||||
return mapper.visitInfos(cmd);
|
return mapper.visitInfos(cmd);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public List<GetForestProducts> forestProducts(GetHouseholdsExcelCmd cmd) { return mapper.forestProductsExcel(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetBankAutoTransfers> bankAutoTransfers(GetHouseholdsExcelCmd cmd) { return mapper.bankAutoTransfersExcel(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetCarryOvers> carryOvers(GetHouseholdsExcelCmd cmd) { return mapper.carryOversExcel(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetDailyIncomeExpense> dailyIncomeExpenses(GetHouseholdsExcelCmd cmd) { return mapper.dailyIncomeExpensesExcel(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetDailyWork> dailyWorks(GetHouseholdsExcelCmd cmd) { return mapper.dailyWorksExcel(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetDailyPower> dailyPowers(GetHouseholdsExcelCmd cmd) { return mapper.dailyPowersExcel(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetDailyForestry> dailyForestry(GetHouseholdsExcelCmd cmd) { return mapper.dailyForestryExcel(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetDailyFarming> dailyFarmings(GetHouseholdsExcelCmd cmd) { return mapper.dailyFarmingsExcel(cmd); }
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.adapters.persistence;
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.adapters.persistence;
|
||||||
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholdsExcelCmd;
|
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.*;
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetDailyRecords;
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholds;
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetVisitInfos;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@@ -12,4 +10,12 @@ public interface GetHouseholdsExcelMapper {
|
|||||||
List<GetHouseholds> households(GetHouseholdsExcelCmd cmd);
|
List<GetHouseholds> households(GetHouseholdsExcelCmd cmd);
|
||||||
List<GetDailyRecords> dailyRecords(GetHouseholdsExcelCmd cmd);
|
List<GetDailyRecords> dailyRecords(GetHouseholdsExcelCmd cmd);
|
||||||
List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd);
|
List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetForestProducts> forestProductsExcel(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetBankAutoTransfers> bankAutoTransfersExcel(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetCarryOvers> carryOversExcel(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetDailyIncomeExpense> dailyIncomeExpensesExcel(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetDailyWork> dailyWorksExcel(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetDailyPower> dailyPowersExcel(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetDailyForestry> dailyForestryExcel(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetDailyFarming> dailyFarmingsExcel(GetHouseholdsExcelCmd cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,7 @@ import app.module.admin.config.application.util.ExcelWriterUtil;
|
|||||||
import app.module.admin.config.application.util.model.ExcelSheetDto;
|
import app.module.admin.config.application.util.model.ExcelSheetDto;
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.adapters.web.model.GetHouseholdsExcelReqVO;
|
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.adapters.web.model.GetHouseholdsExcelReqVO;
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.GetHouseholdsExcelPortIn;
|
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.GetHouseholdsExcelPortIn;
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetDailyRecords;
|
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.*;
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholds;
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholdsExcelCmd;
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetVisitInfos;
|
|
||||||
import app.module.admin.usecase.household.getHouseholdsStatus.ports.GetHouseholdsStatusPortIn;
|
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.GetHouseholdsStatus;
|
||||||
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatusCmd;
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatusCmd;
|
||||||
@@ -21,6 +18,8 @@ import java.time.format.DateTimeFormatter;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import app.module.core.config.application.util.DailyUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -39,6 +38,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
class GetHouseholdsExcelController {
|
class GetHouseholdsExcelController {
|
||||||
private final GetHouseholdsStatusPortIn getHouseholdsStatusPortIn;
|
private final GetHouseholdsStatusPortIn getHouseholdsStatusPortIn;
|
||||||
private final GetHouseholdsExcelPortIn getHouseholdsExcelPortIn;
|
private final GetHouseholdsExcelPortIn getHouseholdsExcelPortIn;
|
||||||
|
private final DailyUtil dailyUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 엑셀 다운로드 응답용 데이터 클래스.
|
* 엑셀 다운로드 응답용 데이터 클래스.
|
||||||
@@ -97,8 +97,25 @@ class GetHouseholdsExcelController {
|
|||||||
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth()))
|
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth()))
|
||||||
);
|
);
|
||||||
case DAILY_RECORD -> // 일계부 등록 데이터
|
case DAILY_RECORD -> // 일계부 등록 데이터
|
||||||
// TODO : 추가하기
|
dailyRegisterExcel(
|
||||||
null;
|
getHouseholdsExcelPortIn.forestProducts(
|
||||||
|
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth())),
|
||||||
|
getHouseholdsExcelPortIn.bankAutoTransfers(
|
||||||
|
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth())),
|
||||||
|
getHouseholdsExcelPortIn.carryOvers(
|
||||||
|
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth())),
|
||||||
|
getHouseholdsExcelPortIn.dailyIncomeExpenses(
|
||||||
|
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth())),
|
||||||
|
getHouseholdsExcelPortIn.dailyWorks(
|
||||||
|
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth())),
|
||||||
|
getHouseholdsExcelPortIn.dailyPowers(
|
||||||
|
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth())),
|
||||||
|
getHouseholdsExcelPortIn.dailyForestry(
|
||||||
|
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth())),
|
||||||
|
getHouseholdsExcelPortIn.dailyFarmings(
|
||||||
|
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth()))
|
||||||
|
|
||||||
|
);
|
||||||
default -> null;
|
default -> null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -302,4 +319,334 @@ class GetHouseholdsExcelController {
|
|||||||
|
|
||||||
return new ExcelResult(excel, encodedFileName);
|
return new ExcelResult(excel, encodedFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 엑셀 다운로드 템플릿 - 일계부 등록 데이터
|
||||||
|
* */
|
||||||
|
private ExcelResult dailyRegisterExcel(
|
||||||
|
List<GetForestProducts> forestItems,
|
||||||
|
List<GetBankAutoTransfers> bankAutoTransferItems,
|
||||||
|
List<GetCarryOvers> carryOverItems,
|
||||||
|
List<GetDailyIncomeExpense> dailyIncomeExpenseItems ,
|
||||||
|
List<GetDailyWork> dailyWorkItems,
|
||||||
|
List<GetDailyPower> dailyPowerItems,
|
||||||
|
List<GetDailyForestry> dailyForestryItems,
|
||||||
|
List<GetDailyFarming> dailyFarmingItems ){
|
||||||
|
|
||||||
|
// 시트 1: 임산물 현황
|
||||||
|
List<List<String>> rows = new ArrayList<>();
|
||||||
|
for(GetForestProducts item : forestItems) {
|
||||||
|
rows.add(List.of(
|
||||||
|
StringUtils.defaultString(item.getHouseholdNum()),
|
||||||
|
StringUtils.defaultString(item.getOwnerName()),
|
||||||
|
StringUtils.defaultString(item.getStreetNum()),
|
||||||
|
StringUtils.defaultString(item.getLandType()),
|
||||||
|
StringUtils.defaultString(item.getTown()),
|
||||||
|
StringUtils.defaultString(item.getAvailableArea()),
|
||||||
|
StringUtils.defaultString(item.getCropName()),
|
||||||
|
StringUtils.defaultString(item.getCropCode()),
|
||||||
|
StringUtils.defaultString(item.getLandArea()),
|
||||||
|
StringUtils.defaultString(item.getMainYield()),
|
||||||
|
StringUtils.defaultString(item.getMainYieldUnitCodeName()),
|
||||||
|
StringUtils.defaultString(item.getMainSaleAmount()),
|
||||||
|
StringUtils.defaultString(item.getMainSaleUnitCodeName()),
|
||||||
|
StringUtils.defaultString(item.getSubYield()),
|
||||||
|
StringUtils.defaultString(item.getSubYieldUnitCodeName()),
|
||||||
|
StringUtils.defaultString(item.getSubSaleAmount()),
|
||||||
|
StringUtils.defaultString(item.getSubSaleUnitCodeName())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ExcelSheetDto sheet1 = new ExcelSheetDto("임산물 현황",
|
||||||
|
List.of(
|
||||||
|
"임가번호",
|
||||||
|
"경영주 성명",
|
||||||
|
"지번",
|
||||||
|
"지목",
|
||||||
|
"읍면동",
|
||||||
|
"가능면적(평)",
|
||||||
|
"재배 작물명",
|
||||||
|
"작물 부호",
|
||||||
|
"면적",
|
||||||
|
"주생산물 수확량",
|
||||||
|
"단위",
|
||||||
|
"주생산물 판매량",
|
||||||
|
"단위.1",
|
||||||
|
"부생산물 수확량",
|
||||||
|
"단위.2",
|
||||||
|
"부생산물 판매량",
|
||||||
|
"단위.3"
|
||||||
|
),
|
||||||
|
rows,
|
||||||
|
null,
|
||||||
|
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
||||||
|
|
||||||
|
// 시트 2: 자동이체_수입(지출) 현황
|
||||||
|
rows = new ArrayList<>();
|
||||||
|
for(GetBankAutoTransfers item : bankAutoTransferItems) {
|
||||||
|
rows.add(List.of(
|
||||||
|
StringUtils.defaultString(item.getHouseholdNum()),
|
||||||
|
StringUtils.defaultString(item.getOwnerName()),
|
||||||
|
StringUtils.defaultString(item.getTransferTypeName()),
|
||||||
|
StringUtils.defaultString(item.getIncomeCode()),
|
||||||
|
StringUtils.defaultString(item.getExpenseCode()),
|
||||||
|
StringUtils.defaultString(item.getCropCode()),
|
||||||
|
StringUtils.defaultString(item.getTransferCategoryCodeName()),
|
||||||
|
StringUtils.defaultString(item.getSourcePurpose()),
|
||||||
|
StringUtils.defaultString(item.getCount()),
|
||||||
|
StringUtils.defaultString(item.getUnitCodeName()),
|
||||||
|
StringUtils.defaultString(dailyUtil.getStringComma(item.getPrice()))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ExcelSheetDto sheet2 = new ExcelSheetDto("자동이체_수입(지출)",
|
||||||
|
List.of(
|
||||||
|
"임가번호",
|
||||||
|
"경영주 성명",
|
||||||
|
"유형",
|
||||||
|
"수입 부호",
|
||||||
|
"지출 부호",
|
||||||
|
"재배형태 코드",
|
||||||
|
"수입(지출)의 종류",
|
||||||
|
"수입원(용도)",
|
||||||
|
"수량",
|
||||||
|
"단위",
|
||||||
|
"현금(원)"
|
||||||
|
),
|
||||||
|
rows,
|
||||||
|
null,
|
||||||
|
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
||||||
|
|
||||||
|
// 시트 3: 월초 이월금
|
||||||
|
rows = new ArrayList<>();
|
||||||
|
for(GetCarryOvers item : carryOverItems) {
|
||||||
|
rows.add(List.of(
|
||||||
|
StringUtils.defaultString(item.getHouseholdNum()),
|
||||||
|
StringUtils.defaultString(item.getOwnerName()),
|
||||||
|
StringUtils.defaultString(dailyUtil.getStringComma(item.getCarryOver()))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
ExcelSheetDto sheet3 = new ExcelSheetDto("월초이월금",
|
||||||
|
List.of(
|
||||||
|
"임가번호",
|
||||||
|
"경영주 성명",
|
||||||
|
"월초이월금"
|
||||||
|
),
|
||||||
|
rows,
|
||||||
|
null,
|
||||||
|
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
||||||
|
|
||||||
|
// 시트 4: 수입(지출)
|
||||||
|
rows = new ArrayList<>();
|
||||||
|
for(GetDailyIncomeExpense item : dailyIncomeExpenseItems) {
|
||||||
|
rows.add(List.of(
|
||||||
|
StringUtils.defaultString(item.getHouseholdNum()),
|
||||||
|
StringUtils.defaultString(item.getOwnerName()),
|
||||||
|
StringUtils.defaultString(item.getStartDay()),
|
||||||
|
StringUtils.defaultString(item.getEndDay()),
|
||||||
|
StringUtils.defaultString(item.getCategory()),
|
||||||
|
StringUtils.defaultString(item.getIncomeMark()),
|
||||||
|
StringUtils.defaultString(item.getExpenseMark()),
|
||||||
|
StringUtils.defaultString(item.getCropCode()),
|
||||||
|
StringUtils.defaultString(item.getKind()),
|
||||||
|
StringUtils.defaultString(item.getSourcePurpose()),
|
||||||
|
StringUtils.defaultString(item.getQuantity()),
|
||||||
|
StringUtils.defaultString(item.getUnitCodeName()),
|
||||||
|
StringUtils.defaultString(dailyUtil.getStringComma(item.getPrice())),
|
||||||
|
StringUtils.defaultString(dailyUtil.getStringComma(item.getEstimatedValue()))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
ExcelSheetDto sheet4 = new ExcelSheetDto("수입(지출)",
|
||||||
|
List.of(
|
||||||
|
"임가번호",
|
||||||
|
"경영주 성명",
|
||||||
|
"날",
|
||||||
|
"짜",
|
||||||
|
"유형",
|
||||||
|
"수입 부호",
|
||||||
|
"지출 부호",
|
||||||
|
"재배형태 코드",
|
||||||
|
"수입(지출)의 종류",
|
||||||
|
"수입원(용도)",
|
||||||
|
"수량",
|
||||||
|
"단위",
|
||||||
|
"현금(원)",
|
||||||
|
"현물(평가액)"
|
||||||
|
),
|
||||||
|
rows,
|
||||||
|
null,
|
||||||
|
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
||||||
|
|
||||||
|
// 시트 5: 임업노동 투입내역
|
||||||
|
rows = new ArrayList<>();
|
||||||
|
for(GetDailyWork item : dailyWorkItems) {
|
||||||
|
rows.add(List.of(
|
||||||
|
StringUtils.defaultString(item.getHouseholdNum()),
|
||||||
|
StringUtils.defaultString(item.getOwnerName()),
|
||||||
|
StringUtils.defaultString(item.getStartDay()),
|
||||||
|
StringUtils.defaultString(item.getEndDay()),
|
||||||
|
StringUtils.defaultString(item.getItemName()),
|
||||||
|
StringUtils.defaultString(item.getItemMark()),
|
||||||
|
StringUtils.defaultString(item.getWorkName()),
|
||||||
|
StringUtils.defaultString(item.getWorkMark()),
|
||||||
|
StringUtils.defaultString(item.getWorkLandArea()),
|
||||||
|
StringUtils.defaultString(item.getAreaUnitName()),
|
||||||
|
StringUtils.defaultString(item.getHarvestQuantity()),
|
||||||
|
StringUtils.defaultString(item.getHarvestUnitName()),
|
||||||
|
StringUtils.defaultString(item.getOwnerTime()),
|
||||||
|
StringUtils.defaultString(item.getSpouseTime()),
|
||||||
|
StringUtils.defaultString(item.getFamilyMHours()),
|
||||||
|
StringUtils.defaultString(item.getFamilyFHours()),
|
||||||
|
StringUtils.defaultString(item.getHiredMHours()),
|
||||||
|
StringUtils.defaultString(item.getHiredFHours()),
|
||||||
|
StringUtils.defaultString(item.getSharedMHours()),
|
||||||
|
StringUtils.defaultString(item.getSharedFHours()),
|
||||||
|
StringUtils.defaultString(item.getVolunteerMHours()),
|
||||||
|
StringUtils.defaultString(item.getVolunteerMHours())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
ExcelSheetDto sheet5 = new ExcelSheetDto("임업노동 투입내역",
|
||||||
|
List.of(
|
||||||
|
"임가번호",
|
||||||
|
"경영주 성명",
|
||||||
|
"날",
|
||||||
|
"짜",
|
||||||
|
"품목명",
|
||||||
|
"품목 부호",
|
||||||
|
"작업명",
|
||||||
|
"작업 부호",
|
||||||
|
"작업면적",
|
||||||
|
"단위",
|
||||||
|
"수확량",
|
||||||
|
"단위",
|
||||||
|
"경영주",
|
||||||
|
"배우자",
|
||||||
|
"가족노동 남",
|
||||||
|
"가족노동 여",
|
||||||
|
"고용노동 남",
|
||||||
|
"고용노동 여",
|
||||||
|
"품앗이 남",
|
||||||
|
"품앗이 여",
|
||||||
|
"일손돕기 남",
|
||||||
|
"일손돕기 여"
|
||||||
|
),
|
||||||
|
rows,
|
||||||
|
null,
|
||||||
|
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
||||||
|
|
||||||
|
// 시트 6: 동력사용시간
|
||||||
|
rows = new ArrayList<>();
|
||||||
|
for(GetDailyPower item : dailyPowerItems) {
|
||||||
|
rows.add(List.of(
|
||||||
|
StringUtils.defaultString(item.getHouseholdNum()),
|
||||||
|
StringUtils.defaultString(item.getOwnerName()),
|
||||||
|
StringUtils.defaultString(item.getStartDay()),
|
||||||
|
StringUtils.defaultString(item.getEndDay()),
|
||||||
|
StringUtils.defaultString(item.getEquipmentName()),
|
||||||
|
StringUtils.defaultString(item.getEquipmentMark()),
|
||||||
|
StringUtils.defaultString(item.getOwnedHours()),
|
||||||
|
StringUtils.defaultString(item.getLeasedHours())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
ExcelSheetDto sheet6 = new ExcelSheetDto("동력사용시간",
|
||||||
|
List.of(
|
||||||
|
"임가번호",
|
||||||
|
"경영주 성명",
|
||||||
|
"날",
|
||||||
|
"짜",
|
||||||
|
"명칭",
|
||||||
|
"부호",
|
||||||
|
"자가시간",
|
||||||
|
"임차시간"
|
||||||
|
),
|
||||||
|
rows,
|
||||||
|
null,
|
||||||
|
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
||||||
|
|
||||||
|
// 시트 7: 자가임업생산물 중 자가소비량
|
||||||
|
rows = new ArrayList<>();
|
||||||
|
for(GetDailyForestry item : dailyForestryItems) {
|
||||||
|
rows.add(List.of(
|
||||||
|
StringUtils.defaultString(item.getHouseholdNum()),
|
||||||
|
StringUtils.defaultString(item.getOwnerName()),
|
||||||
|
StringUtils.defaultString(item.getWeekOfMonth()),
|
||||||
|
StringUtils.defaultString(item.getIncomeMark()),
|
||||||
|
StringUtils.defaultString(item.getExpenseMark()),
|
||||||
|
StringUtils.defaultString(item.getProductName()),
|
||||||
|
StringUtils.defaultString(item.getUsage()),
|
||||||
|
StringUtils.defaultString(item.getQuantity()),
|
||||||
|
StringUtils.defaultString(item.getUnitName()),
|
||||||
|
StringUtils.defaultString(dailyUtil.getStringComma(item.getEstimatedValue()))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
ExcelSheetDto sheet7 = new ExcelSheetDto(" 자가임업생산물 중 자가소비량",
|
||||||
|
List.of(
|
||||||
|
"임가번호",
|
||||||
|
"경영주 성명",
|
||||||
|
"차수",
|
||||||
|
"수입 부호",
|
||||||
|
"지출 부호",
|
||||||
|
"생산물",
|
||||||
|
"용도",
|
||||||
|
"수량",
|
||||||
|
"단위",
|
||||||
|
"현물평가액"
|
||||||
|
),
|
||||||
|
rows,
|
||||||
|
null,
|
||||||
|
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 시트 8: 자가농업생산물 중 자가소비량
|
||||||
|
rows = new ArrayList<>();
|
||||||
|
for(GetDailyFarming item : dailyFarmingItems) {
|
||||||
|
rows.add(List.of(
|
||||||
|
StringUtils.defaultString(item.getHouseholdNum()),
|
||||||
|
StringUtils.defaultString(item.getOwnerName()),
|
||||||
|
StringUtils.defaultString(item.getStartDay()),
|
||||||
|
StringUtils.defaultString(item.getEndDay()),
|
||||||
|
StringUtils.defaultString(item.getIncomeMark()),
|
||||||
|
StringUtils.defaultString(item.getExpenseMark()),
|
||||||
|
StringUtils.defaultString(item.getProductName()),
|
||||||
|
StringUtils.defaultString(item.getUsage()),
|
||||||
|
StringUtils.defaultString(item.getQuantity()),
|
||||||
|
StringUtils.defaultString(item.getUnitName()),
|
||||||
|
StringUtils.defaultString(dailyUtil.getStringComma(item.getEstimatedValue()))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
ExcelSheetDto sheet8 = new ExcelSheetDto("자가농업생산물 중 자가소비량",
|
||||||
|
List.of(
|
||||||
|
"임가번호",
|
||||||
|
"경영주 성명",
|
||||||
|
"날",
|
||||||
|
"짜",
|
||||||
|
"수입 부호",
|
||||||
|
"지출 부호",
|
||||||
|
"생산물",
|
||||||
|
"용도",
|
||||||
|
"수량",
|
||||||
|
"단위",
|
||||||
|
"현물평가액"
|
||||||
|
),
|
||||||
|
rows,
|
||||||
|
null,
|
||||||
|
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
||||||
|
|
||||||
|
List<ExcelSheetDto> sheets = List.of(sheet1,sheet2,sheet3,sheet4,sheet5,sheet6,sheet7,sheet8);
|
||||||
|
byte[] excel = ExcelWriterUtil.writeExcel(sheets);
|
||||||
|
|
||||||
|
String rawFileName = "일계부등록데이터_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx";
|
||||||
|
String encodedFileName = URLEncoder.encode(rawFileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20");
|
||||||
|
|
||||||
|
return new ExcelResult(excel, encodedFileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports;
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports;
|
||||||
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholdsExcelCmd;
|
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.*;
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetDailyRecords;
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholds;
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetVisitInfos;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface GetHouseholdsExcelPortIn {
|
public interface GetHouseholdsExcelPortIn {
|
||||||
@@ -13,4 +11,20 @@ public interface GetHouseholdsExcelPortIn {
|
|||||||
List<GetDailyRecords> dailyRecords(GetHouseholdsExcelCmd cmd);
|
List<GetDailyRecords> dailyRecords(GetHouseholdsExcelCmd cmd);
|
||||||
// 임가방문정보
|
// 임가방문정보
|
||||||
List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd);
|
List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd);
|
||||||
|
// 임산물 현황
|
||||||
|
List<GetForestProducts> forestProducts(GetHouseholdsExcelCmd cmd);
|
||||||
|
// 자동이체_수입(지출)
|
||||||
|
List<GetBankAutoTransfers> bankAutoTransfers(GetHouseholdsExcelCmd cmd);
|
||||||
|
// 월초이월금
|
||||||
|
List<GetCarryOvers> carryOvers(GetHouseholdsExcelCmd cmd);
|
||||||
|
// 수입(지출)
|
||||||
|
List<GetDailyIncomeExpense> dailyIncomeExpenses(GetHouseholdsExcelCmd cmd);
|
||||||
|
// 임엄노동투입내역
|
||||||
|
List<GetDailyWork> dailyWorks(GetHouseholdsExcelCmd cmd);
|
||||||
|
// 동력사용시간
|
||||||
|
List<GetDailyPower> dailyPowers(GetHouseholdsExcelCmd cmd);
|
||||||
|
// 자가임업생산물 중 자가소비량
|
||||||
|
List<GetDailyForestry> dailyForestry(GetHouseholdsExcelCmd cmd);
|
||||||
|
// 자가농업생산물 중 자가소비량
|
||||||
|
List<GetDailyFarming> dailyFarmings(GetHouseholdsExcelCmd cmd);
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,19 @@
|
|||||||
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports;
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports;
|
||||||
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholdsExcelCmd;
|
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.*;
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetDailyRecords;
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholds;
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetVisitInfos;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface GetHouseholdsExcelPortOut {
|
public interface GetHouseholdsExcelPortOut {
|
||||||
List<GetHouseholds> households(GetHouseholdsExcelCmd cmd);
|
List<GetHouseholds> households(GetHouseholdsExcelCmd cmd);
|
||||||
List<GetDailyRecords> dailyRecords(GetHouseholdsExcelCmd cmd);
|
List<GetDailyRecords> dailyRecords(GetHouseholdsExcelCmd cmd);
|
||||||
List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd);
|
List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetForestProducts> forestProducts(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetBankAutoTransfers> bankAutoTransfers(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetCarryOvers> carryOvers(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetDailyIncomeExpense> dailyIncomeExpenses(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetDailyWork> dailyWorks(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetDailyPower> dailyPowers(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetDailyForestry> dailyForestry(GetHouseholdsExcelCmd cmd);
|
||||||
|
List<GetDailyFarming> dailyFarmings(GetHouseholdsExcelCmd cmd);
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application;
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application;
|
||||||
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetDailyRecords;
|
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.*;
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholds;
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetVisitInfos;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholdsExcelCmd;
|
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.GetHouseholdsExcelPortIn;
|
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.GetHouseholdsExcelPortIn;
|
||||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.GetHouseholdsExcelPortOut;
|
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.GetHouseholdsExcelPortOut;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -29,4 +26,29 @@ class GetHouseholdsExcelService implements GetHouseholdsExcelPortIn {
|
|||||||
public List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd) {
|
public List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd) {
|
||||||
return portOut.visitInfos(cmd);
|
return portOut.visitInfos(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetForestProducts> forestProducts(GetHouseholdsExcelCmd cmd) { return portOut.forestProducts(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetBankAutoTransfers> bankAutoTransfers(GetHouseholdsExcelCmd cmd) { return portOut.bankAutoTransfers(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetCarryOvers> carryOvers(GetHouseholdsExcelCmd cmd) { return portOut.carryOvers(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetDailyIncomeExpense> dailyIncomeExpenses(GetHouseholdsExcelCmd cmd) { return portOut.dailyIncomeExpenses(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetDailyWork> dailyWorks(GetHouseholdsExcelCmd cmd) { return portOut.dailyWorks(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetDailyPower> dailyPowers(GetHouseholdsExcelCmd cmd) { return portOut.dailyPowers(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetDailyForestry> dailyForestry(GetHouseholdsExcelCmd cmd) { return portOut.dailyForestry(cmd); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GetDailyFarming> dailyFarmings(GetHouseholdsExcelCmd cmd) { return portOut.dailyFarmings(cmd); }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetBankAutoTransfers {
|
||||||
|
private String householdNum;
|
||||||
|
private String ownerName;
|
||||||
|
private String transferTypeName;
|
||||||
|
private String incomeCode;
|
||||||
|
private String expenseCode;
|
||||||
|
private String cropCode;
|
||||||
|
private String transferCategoryCodeName;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private String count;
|
||||||
|
private String unitCodeName;
|
||||||
|
private String price;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetCarryOvers {
|
||||||
|
private String householdNum;
|
||||||
|
private String ownerName;
|
||||||
|
private String carryOver;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetDailyFarming {
|
||||||
|
private String householdNum;
|
||||||
|
private String ownerName;
|
||||||
|
private String startDay;
|
||||||
|
private String endDay;
|
||||||
|
private String incomeMark;
|
||||||
|
private String expenseMark;
|
||||||
|
private String productName;
|
||||||
|
private String usage;
|
||||||
|
private String quantity;
|
||||||
|
private String unitName;
|
||||||
|
private String estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetDailyForestry {
|
||||||
|
private String householdNum;
|
||||||
|
private String ownerName;
|
||||||
|
private String weekOfMonth;
|
||||||
|
private String incomeMark;
|
||||||
|
private String expenseMark;
|
||||||
|
private String productName;
|
||||||
|
private String usage;
|
||||||
|
private String quantity;
|
||||||
|
private String unitName;
|
||||||
|
private String estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetDailyIncomeExpense {
|
||||||
|
private String householdNum;
|
||||||
|
private String ownerName;
|
||||||
|
private String startDay;
|
||||||
|
private String endDay;
|
||||||
|
private String category;
|
||||||
|
private String incomeMark;
|
||||||
|
private String expenseMark;
|
||||||
|
private String cropCode;
|
||||||
|
private String kind;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private String quantity;
|
||||||
|
private String unitCodeName;
|
||||||
|
private String price;
|
||||||
|
private String estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetDailyPower {
|
||||||
|
private String householdNum;
|
||||||
|
private String ownerName;
|
||||||
|
private String startDay;
|
||||||
|
private String endDay;
|
||||||
|
private String equipmentName;
|
||||||
|
private String equipmentMark;
|
||||||
|
private String ownedHours;
|
||||||
|
private String leasedHours;
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetDailyWork {
|
||||||
|
private String householdNum;
|
||||||
|
private String ownerName;
|
||||||
|
private String startDay;
|
||||||
|
private String endDay;
|
||||||
|
private String itemName;
|
||||||
|
private String itemMark;
|
||||||
|
private String workName;
|
||||||
|
private String workMark;
|
||||||
|
private String workLandArea;
|
||||||
|
private String areaUnitName;
|
||||||
|
private String harvestQuantity;
|
||||||
|
private String harvestUnitName;
|
||||||
|
private String ownerTime;
|
||||||
|
private String spouseTime;
|
||||||
|
private String familyMHours;
|
||||||
|
private String familyFHours;
|
||||||
|
private String hiredMHours;
|
||||||
|
private String hiredFHours;
|
||||||
|
private String sharedMHours;
|
||||||
|
private String sharedFHours;
|
||||||
|
private String volunteerMHours;
|
||||||
|
private String volunteerFHours;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetForestProducts {
|
||||||
|
private String householdNum;
|
||||||
|
private String ownerName;
|
||||||
|
private String streetNum;
|
||||||
|
private String landType;
|
||||||
|
private String town;
|
||||||
|
private String availableArea;
|
||||||
|
private String cropName;
|
||||||
|
private String cropCode;
|
||||||
|
private String landArea;
|
||||||
|
private String mainYield;
|
||||||
|
private String mainYieldUnitCodeName;
|
||||||
|
private String mainSaleAmount;
|
||||||
|
private String mainSaleUnitCodeName;
|
||||||
|
private String subYield;
|
||||||
|
private String subYieldUnitCodeName;
|
||||||
|
private String subSaleAmount;
|
||||||
|
private String subSaleUnitCodeName;
|
||||||
|
}
|
||||||
@@ -150,4 +150,275 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
ORDER BY household_num
|
ORDER BY household_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="forestProductsExcel"
|
||||||
|
resultType="app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetForestProducts">
|
||||||
|
/* 엑셀 다운로드 - 일계부 등록데이터 ( 1.임산물현황 ) 조회 */
|
||||||
|
WITH unit_codes AS (
|
||||||
|
SELECT id, code_value
|
||||||
|
FROM uicode
|
||||||
|
WHERE parent_id = 'code.record.unit'
|
||||||
|
AND is_deleted = false
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
h.household_num,
|
||||||
|
h.owner_name,
|
||||||
|
fp.street_num,
|
||||||
|
fp.land_type,
|
||||||
|
fp.town,
|
||||||
|
fp.available_area,
|
||||||
|
fp.crop_name,
|
||||||
|
fp.crop_code,
|
||||||
|
fp.land_area,
|
||||||
|
fp.main_yield,
|
||||||
|
CASE WHEN fp.main_yield_unit_code = 'code.record.unit.self' THEN fp.main_yield_unit
|
||||||
|
ELSE (select code_value from unit_codes where id = fp.main_yield_unit_code) END AS main_yield_unit_code_name,
|
||||||
|
fp.main_sale_amount,
|
||||||
|
CASE WHEN fp.main_sale_unit_code = 'code.record.unit.self' THEN fp.main_sale_unit
|
||||||
|
ELSE (select code_value from unit_codes where id = fp.main_sale_unit_code) END AS main_sale_unit_code_name,
|
||||||
|
fp.sub_yield,
|
||||||
|
CASE WHEN fp.sub_yield_unit_code = 'code.record.unit.self' THEN fp.sub_yield_unit
|
||||||
|
ELSE (select code_value from unit_codes where id = fp.sub_yield_unit_code) END AS sub_yield_unit_code_name,
|
||||||
|
fp.sub_sale_amount ,
|
||||||
|
CASE WHEN fp.sub_sale_unit_code = 'code.record.unit.self' THEN fp.sub_sale_unit
|
||||||
|
ELSE (select code_value from unit_codes where id = fp.sub_sale_unit_code) END AS sub_sale_unit_code_name
|
||||||
|
FROM forest_product fp
|
||||||
|
JOIN household h on fp.household_seq = h.seq and h.is_deleted = false
|
||||||
|
WHERE fp.is_deleted = false
|
||||||
|
AND fp.month = #{recordMonth}
|
||||||
|
AND fp.household_seq IN
|
||||||
|
<foreach collection="householdSeqs" item="seq" open="(" separator="," close=")">
|
||||||
|
#{seq}
|
||||||
|
</foreach>
|
||||||
|
ORDER BY household_num
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="bankAutoTransfersExcel"
|
||||||
|
resultType="app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetBankAutoTransfers">
|
||||||
|
/* 엑셀 다운로드 - 일계부 등록데이터 ( 2.자동이체_수입(지출) ) 조회 */
|
||||||
|
WITH category_codes AS (
|
||||||
|
SELECT id, code_text
|
||||||
|
FROM uicode
|
||||||
|
WHERE (parent_id = 'code.bank.input' OR parent_id = 'code.bank.output')
|
||||||
|
AND is_deleted = false
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
h.household_num,
|
||||||
|
h.owner_name,
|
||||||
|
transfer_type.code_text as transfer_type_name,
|
||||||
|
bat.income_code,
|
||||||
|
bat.expense_code,
|
||||||
|
split_part( bat.crop_code,'code.record.crop.',2 ) as crop_code,
|
||||||
|
case when bat.transfer_category_code = 'code.bank.input.self' OR bat.transfer_category_code = 'code.bank.output.self' THEN bat.transfer_category
|
||||||
|
else (select code_text from category_codes where id = bat.transfer_category_code) END AS transfer_category_code_name,
|
||||||
|
bat.source_purpose,
|
||||||
|
bat.count,
|
||||||
|
case when bat.unit_code = 'code.count.unit.self' then bat.unit
|
||||||
|
else unit_code.code_text end as unit_code_name,
|
||||||
|
bat.price
|
||||||
|
FROM bank_auto_transfer bat
|
||||||
|
JOIN household h on bat.household_seq = h.seq and h.is_deleted = false
|
||||||
|
LEFT JOIN uicode transfer_type on transfer_type.parent_id = 'code.bank' and transfer_type.id = bat.transfer_type
|
||||||
|
LEFT JOIN uicode unit_code on unit_code.parent_id = 'code.count.unit' and unit_code.id = bat.unit_code and unit_code.is_deleted = false
|
||||||
|
WHERE bat.is_deleted = false
|
||||||
|
AND bat.month = #{recordMonth}
|
||||||
|
AND bat.household_seq IN
|
||||||
|
<foreach collection="householdSeqs" item="seq" open="(" separator="," close=")">
|
||||||
|
#{seq}
|
||||||
|
</foreach>
|
||||||
|
ORDER BY household_num
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="carryOversExcel">
|
||||||
|
select
|
||||||
|
h.household_num,
|
||||||
|
h.owner_name,
|
||||||
|
ds.carry_over
|
||||||
|
from daily_summary ds
|
||||||
|
JOIN household h on ds.household_seq = h.seq and h.is_deleted = false
|
||||||
|
where ds.record_month = #{recordMonth}
|
||||||
|
AND ds.household_seq IN
|
||||||
|
<foreach collection="householdSeqs" item="seq" open="(" separator="," close=")">
|
||||||
|
#{seq}
|
||||||
|
</foreach>
|
||||||
|
order by household_num desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="dailyIncomeExpensesExcel">
|
||||||
|
select
|
||||||
|
h.household_num,
|
||||||
|
h.owner_name,
|
||||||
|
dg.start_day ,
|
||||||
|
case when dg.start_day = dg.end_day then null else dg.end_day end as end_day ,
|
||||||
|
di.category ,
|
||||||
|
di.income_mark ,
|
||||||
|
di.expense_mark ,
|
||||||
|
split_part( di.crop_code,'code.record.crop.',2 ) as crop_code,
|
||||||
|
di.income_kind as kind,
|
||||||
|
di.source_purpose ,
|
||||||
|
di.quantity,
|
||||||
|
unit_code.code_text as unit_code_name ,
|
||||||
|
di.price,
|
||||||
|
di.estimated_value
|
||||||
|
from household h
|
||||||
|
join daily_record dr on h.seq = dr.household_seq and dr.is_deleted = false
|
||||||
|
left join daily_day_group dg on dg.group_no = dr.day_group_no and dg.is_deleted = false
|
||||||
|
join daily_income di on dr.id = di.daily_record_seq and di.is_deleted = false
|
||||||
|
left join uicode unit_code on unit_code.parent_id = 'code.record.unit' and unit_code.id = di.unit_code and unit_code.is_deleted = false
|
||||||
|
where h.is_deleted = false
|
||||||
|
AND dr.record_month = #{recordMonth}
|
||||||
|
AND h.seq IN
|
||||||
|
<foreach collection="householdSeqs" item="seq" open="(" separator="," close=")">
|
||||||
|
#{seq}
|
||||||
|
</foreach>
|
||||||
|
union all
|
||||||
|
select
|
||||||
|
h.household_num,
|
||||||
|
h.owner_name,
|
||||||
|
dg.start_day ,
|
||||||
|
case when dg.start_day = dg.end_day then null else dg.end_day end as end_day ,
|
||||||
|
de.category ,
|
||||||
|
de.income_mark ,
|
||||||
|
de.expense_mark ,
|
||||||
|
null as crop_code,
|
||||||
|
de.expense_kind as kind,
|
||||||
|
de.source_purpose ,
|
||||||
|
de.quantity,
|
||||||
|
unit_code.code_text as unit_code_name ,
|
||||||
|
de.price,
|
||||||
|
de.estimated_value
|
||||||
|
from household h
|
||||||
|
join daily_record dr on h.seq = dr.household_seq and dr.is_deleted = false
|
||||||
|
left join daily_day_group dg on dg.group_no = dr.day_group_no and dg.is_deleted = false
|
||||||
|
join daily_expense de on dr.id = de.daily_record_seq and de.is_deleted = false
|
||||||
|
left join uicode unit_code on unit_code.parent_id = 'code.record.unit' and unit_code.id = de.unit_code and unit_code.is_deleted = false
|
||||||
|
where h.is_deleted = false
|
||||||
|
AND dr.record_month = #{recordMonth}
|
||||||
|
AND h.seq IN
|
||||||
|
<foreach collection="householdSeqs" item="seq" open="(" separator="," close=")">
|
||||||
|
#{seq}
|
||||||
|
</foreach>
|
||||||
|
order by household_num
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="dailyWorksExcel">
|
||||||
|
select
|
||||||
|
h.household_num ,
|
||||||
|
h.owner_name ,
|
||||||
|
dg.start_day ,
|
||||||
|
case when dg.start_day = dg.end_day then null else dg.end_day end as end_day ,
|
||||||
|
dw.item_name ,
|
||||||
|
dw.item_mark ,
|
||||||
|
dw.work_name ,
|
||||||
|
dw.work_mark ,
|
||||||
|
dw.work_land_area ,
|
||||||
|
case when dw.area_unit_code = 'code.record.area.self' then dw.area_unit_self
|
||||||
|
else unit_code.code_value end as area_unit_name,
|
||||||
|
dw.harvest_quantity ,
|
||||||
|
case when dw.harvest_unit_code = 'code.record.unit.self' then dw.harvest_unit_self
|
||||||
|
else unit_code.code_value end as harvest_unit_name,
|
||||||
|
dw.owner_time ,
|
||||||
|
dw.spouse_time ,
|
||||||
|
dw.family_m_hours ,
|
||||||
|
dw.family_f_hours ,
|
||||||
|
dw.hired_m_hours ,
|
||||||
|
dw.hired_f_hours ,
|
||||||
|
dw.shared_m_hours,
|
||||||
|
dw.shared_f_hours,
|
||||||
|
dw.volunteer_m_hours ,
|
||||||
|
dw.volunteer_f_hours
|
||||||
|
from household h
|
||||||
|
join daily_record dr on h.seq = dr.household_seq and dr.is_deleted = false
|
||||||
|
left join daily_day_group dg on dg.group_no = dr.day_group_no and dg.is_deleted = false
|
||||||
|
join daily_work dw on dw.daily_record_seq = dr.id and dw.is_deleted = false
|
||||||
|
left join uicode area_code on area_code.parent_id = 'code.record.area' and area_code.id = dw.area_unit_code
|
||||||
|
left join uicode unit_code on unit_code.parent_id = 'code.record.unit' and unit_code.id = dw.harvest_unit_code and unit_code.is_deleted = false
|
||||||
|
where h.is_deleted = false
|
||||||
|
AND dr.record_month = #{recordMonth}
|
||||||
|
AND h.seq IN
|
||||||
|
<foreach collection="householdSeqs" item="seq" open="(" separator="," close=")">
|
||||||
|
#{seq}
|
||||||
|
</foreach>
|
||||||
|
order by household_num
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="dailyPowersExcel">
|
||||||
|
select
|
||||||
|
h.household_num ,
|
||||||
|
h.owner_name ,
|
||||||
|
dg.start_day ,
|
||||||
|
case when dg.start_day = dg.end_day then null else dg.end_day end as end_day ,
|
||||||
|
dp.equipment_name ,
|
||||||
|
dp.equipment_mark ,
|
||||||
|
dp.owned_hours ,
|
||||||
|
dp.leased_hours
|
||||||
|
from household h
|
||||||
|
join daily_record dr on h.seq = dr.household_seq and dr.is_deleted = false
|
||||||
|
left join daily_day_group dg on dg.group_no = dr.day_group_no and dg.is_deleted = false
|
||||||
|
join daily_power dp on dp.daily_record_seq = dr.id and dp.is_deleted = false
|
||||||
|
where h.is_deleted = false
|
||||||
|
AND dr.record_month = #{recordMonth}
|
||||||
|
AND h.seq IN
|
||||||
|
<foreach collection="householdSeqs" item="seq" open="(" separator="," close=")">
|
||||||
|
#{seq}
|
||||||
|
</foreach>
|
||||||
|
order by household_num
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="dailyForestryExcel">
|
||||||
|
select
|
||||||
|
h.household_num ,
|
||||||
|
h.owner_name ,
|
||||||
|
extract(week from dr.start_date) - extract(week from DATE_TRUNC('month', dr.start_date)) + 1 AS week_of_month,
|
||||||
|
df.income_mark,
|
||||||
|
df.expense_mark,
|
||||||
|
df.product_name,
|
||||||
|
df."usage",
|
||||||
|
df.quantity,
|
||||||
|
case when df.unit_code = 'code.record.unit.self' then df.unit_self
|
||||||
|
else unit_code.code_value end as unit_name,
|
||||||
|
df.estimated_value
|
||||||
|
from household h
|
||||||
|
join daily_record dr on h.seq = dr.household_seq and dr.is_deleted = false
|
||||||
|
left join daily_day_group dg on dg.group_no = dr.day_group_no and dg.is_deleted = false
|
||||||
|
join daily_forestry df on df.daily_record_seq = dr.id and df.is_deleted = false
|
||||||
|
left join uicode unit_code on unit_code.parent_id = 'code.record.unit' and unit_code.id = df.unit_code
|
||||||
|
where h.is_deleted = false
|
||||||
|
AND dr.record_month = #{recordMonth}
|
||||||
|
AND h.seq IN
|
||||||
|
<foreach collection="householdSeqs" item="seq" open="(" separator="," close=")">
|
||||||
|
#{seq}
|
||||||
|
</foreach>
|
||||||
|
order by household_num
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="dailyFarmingsExcel">
|
||||||
|
select
|
||||||
|
h.household_num ,
|
||||||
|
h.owner_name ,
|
||||||
|
dg.start_day ,
|
||||||
|
case when dg.start_day = dg.end_day then null else dg.end_day end as end_day ,
|
||||||
|
df.income_mark ,
|
||||||
|
df.expense_mark ,
|
||||||
|
case when df.product_code = 'code.record.farming.self' then df.product_self
|
||||||
|
else product_code.code_text end as product_name ,
|
||||||
|
df."usage" ,
|
||||||
|
df.quantity ,
|
||||||
|
case when df.unit_code = 'code.record.unit.self' then df.unit_self
|
||||||
|
else unit_code.code_value end as unit_name,
|
||||||
|
df.estimated_value
|
||||||
|
from household h
|
||||||
|
join daily_record dr on h.seq = dr.household_seq and dr.is_deleted = false
|
||||||
|
left join daily_day_group dg on dg.group_no = dr.day_group_no and dg.is_deleted = false
|
||||||
|
join daily_farming df on df.daily_record_seq = dr.id and df.is_deleted = false
|
||||||
|
left join uicode product_code on product_code.parent_id = 'code.record.farming' and product_code.id = df.product_code
|
||||||
|
left join uicode unit_code on unit_code.parent_id = 'code.record.unit' and unit_code.id = df.unit_code
|
||||||
|
where h.is_deleted = false
|
||||||
|
AND dr.record_month = #{recordMonth}
|
||||||
|
AND h.seq IN
|
||||||
|
<foreach collection="householdSeqs" item="seq" open="(" separator="," close=")">
|
||||||
|
#{seq}
|
||||||
|
</foreach>
|
||||||
|
order by household_num
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user