엑셀 다운로드 일계부 등록 데이터 완료
This commit is contained in:
@@ -27,8 +27,27 @@ class GetHouseholdsExcelDao implements GetHouseholdsExcelPortOut {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GetForestProducts> forestProducts(GetHouseholdsExcelCmd cmd) { return mapper.forestProducts(cmd); }
|
public List<GetForestProducts> forestProducts(GetHouseholdsExcelCmd cmd) { return mapper.forestProductsExcel(cmd); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GetBankAutoTransfers> bankAutoTransfers(GetHouseholdsExcelCmd cmd) { return mapper.bankAutoTransfers(cmd); }
|
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); }
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,6 +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> forestProducts(GetHouseholdsExcelCmd cmd);
|
List<GetForestProducts> forestProductsExcel(GetHouseholdsExcelCmd cmd);
|
||||||
List<GetBankAutoTransfers> bankAutoTransfers(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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,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;
|
||||||
@@ -36,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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 엑셀 다운로드 응답용 데이터 클래스.
|
* 엑셀 다운로드 응답용 데이터 클래스.
|
||||||
@@ -94,12 +97,24 @@ class GetHouseholdsExcelController {
|
|||||||
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth()))
|
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth()))
|
||||||
);
|
);
|
||||||
case DAILY_RECORD -> // 일계부 등록 데이터
|
case DAILY_RECORD -> // 일계부 등록 데이터
|
||||||
// TODO : 추가하기
|
|
||||||
dailyRegisterExcel(
|
dailyRegisterExcel(
|
||||||
getHouseholdsExcelPortIn.forestProducts(
|
getHouseholdsExcelPortIn.forestProducts(
|
||||||
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth())),
|
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth())),
|
||||||
getHouseholdsExcelPortIn.bankAutoTransfers(
|
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()))
|
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth()))
|
||||||
|
|
||||||
);
|
);
|
||||||
default -> null;
|
default -> null;
|
||||||
};
|
};
|
||||||
@@ -308,7 +323,16 @@ class GetHouseholdsExcelController {
|
|||||||
/**
|
/**
|
||||||
* 엑셀 다운로드 템플릿 - 일계부 등록 데이터
|
* 엑셀 다운로드 템플릿 - 일계부 등록 데이터
|
||||||
* */
|
* */
|
||||||
private ExcelResult dailyRegisterExcel(List<GetForestProducts> forestItems,List<GetBankAutoTransfers> bankAutoTransferItems) {
|
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: 임산물 현황
|
// 시트 1: 임산물 현황
|
||||||
List<List<String>> rows = new ArrayList<>();
|
List<List<String>> rows = new ArrayList<>();
|
||||||
for(GetForestProducts item : forestItems) {
|
for(GetForestProducts item : forestItems) {
|
||||||
@@ -320,7 +344,7 @@ class GetHouseholdsExcelController {
|
|||||||
StringUtils.defaultString(item.getTown()),
|
StringUtils.defaultString(item.getTown()),
|
||||||
StringUtils.defaultString(item.getAvailableArea()),
|
StringUtils.defaultString(item.getAvailableArea()),
|
||||||
StringUtils.defaultString(item.getCropName()),
|
StringUtils.defaultString(item.getCropName()),
|
||||||
StringUtils.defaultString(item.getCropCodeName()),
|
StringUtils.defaultString(item.getCropCode()),
|
||||||
StringUtils.defaultString(item.getLandArea()),
|
StringUtils.defaultString(item.getLandArea()),
|
||||||
StringUtils.defaultString(item.getMainYield()),
|
StringUtils.defaultString(item.getMainYield()),
|
||||||
StringUtils.defaultString(item.getMainYieldUnitCodeName()),
|
StringUtils.defaultString(item.getMainYieldUnitCodeName()),
|
||||||
@@ -359,7 +383,7 @@ class GetHouseholdsExcelController {
|
|||||||
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
||||||
|
|
||||||
// 시트 2: 자동이체_수입(지출) 현황
|
// 시트 2: 자동이체_수입(지출) 현황
|
||||||
rows.clear();
|
rows = new ArrayList<>();
|
||||||
for(GetBankAutoTransfers item : bankAutoTransferItems) {
|
for(GetBankAutoTransfers item : bankAutoTransferItems) {
|
||||||
rows.add(List.of(
|
rows.add(List.of(
|
||||||
StringUtils.defaultString(item.getHouseholdNum()),
|
StringUtils.defaultString(item.getHouseholdNum()),
|
||||||
@@ -367,12 +391,12 @@ class GetHouseholdsExcelController {
|
|||||||
StringUtils.defaultString(item.getTransferTypeName()),
|
StringUtils.defaultString(item.getTransferTypeName()),
|
||||||
StringUtils.defaultString(item.getIncomeCode()),
|
StringUtils.defaultString(item.getIncomeCode()),
|
||||||
StringUtils.defaultString(item.getExpenseCode()),
|
StringUtils.defaultString(item.getExpenseCode()),
|
||||||
StringUtils.defaultString(item.getCropCodeName()),
|
StringUtils.defaultString(item.getCropCode()),
|
||||||
StringUtils.defaultString(item.getTransferCategoryCodeName()),
|
StringUtils.defaultString(item.getTransferCategoryCodeName()),
|
||||||
StringUtils.defaultString(item.getSourcePurpose()),
|
StringUtils.defaultString(item.getSourcePurpose()),
|
||||||
StringUtils.defaultString(item.getCount()),
|
StringUtils.defaultString(item.getCount()),
|
||||||
StringUtils.defaultString(item.getUnitCodeName()),
|
StringUtils.defaultString(item.getUnitCodeName()),
|
||||||
StringUtils.defaultString(item.getPrice())
|
StringUtils.defaultString(dailyUtil.getStringComma(item.getPrice()))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,7 +419,229 @@ class GetHouseholdsExcelController {
|
|||||||
null,
|
null,
|
||||||
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
||||||
|
|
||||||
List<ExcelSheetDto> sheets = List.of(sheet1,sheet2);
|
// 시트 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);
|
byte[] excel = ExcelWriterUtil.writeExcel(sheets);
|
||||||
|
|
||||||
String rawFileName = "일계부등록데이터_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx";
|
String rawFileName = "일계부등록데이터_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx";
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ public interface GetHouseholdsExcelPortIn {
|
|||||||
// 자동이체_수입(지출)
|
// 자동이체_수입(지출)
|
||||||
List<GetBankAutoTransfers> bankAutoTransfers(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);
|
||||||
}
|
}
|
||||||
@@ -10,4 +10,10 @@ public interface GetHouseholdsExcelPortOut {
|
|||||||
List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd);
|
List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd);
|
||||||
List<GetForestProducts> forestProducts(GetHouseholdsExcelCmd cmd);
|
List<GetForestProducts> forestProducts(GetHouseholdsExcelCmd cmd);
|
||||||
List<GetBankAutoTransfers> bankAutoTransfers(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);
|
||||||
}
|
}
|
||||||
@@ -32,4 +32,23 @@ class GetHouseholdsExcelService implements GetHouseholdsExcelPortIn {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GetBankAutoTransfers> bankAutoTransfers(GetHouseholdsExcelCmd cmd) { return portOut.bankAutoTransfers(cmd); }
|
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); }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ public class GetBankAutoTransfers {
|
|||||||
private String transferTypeName;
|
private String transferTypeName;
|
||||||
private String incomeCode;
|
private String incomeCode;
|
||||||
private String expenseCode;
|
private String expenseCode;
|
||||||
private String cropCodeName;
|
private String cropCode;
|
||||||
private String transferCategoryCodeName;
|
private String transferCategoryCodeName;
|
||||||
private String sourcePurpose;
|
private String sourcePurpose;
|
||||||
private String count;
|
private String count;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ public class GetForestProducts {
|
|||||||
private String town;
|
private String town;
|
||||||
private String availableArea;
|
private String availableArea;
|
||||||
private String cropName;
|
private String cropName;
|
||||||
private String cropCodeName;
|
private String cropCode;
|
||||||
private String landArea;
|
private String landArea;
|
||||||
private String mainYield;
|
private String mainYield;
|
||||||
private String mainYieldUnitCodeName;
|
private String mainYieldUnitCodeName;
|
||||||
|
|||||||
@@ -151,11 +151,11 @@
|
|||||||
ORDER BY household_num
|
ORDER BY household_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="forestProducts"
|
<select id="forestProductsExcel"
|
||||||
resultType="app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetForestProducts">
|
resultType="app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetForestProducts">
|
||||||
/* 엑셀 다운로드 - 일계부 등록데이터 ( 1.임산물현황 ) 조회 */
|
/* 엑셀 다운로드 - 일계부 등록데이터 ( 1.임산물현황 ) 조회 */
|
||||||
WITH unit_codes AS (
|
WITH unit_codes AS (
|
||||||
SELECT id, code_text
|
SELECT id, code_value
|
||||||
FROM uicode
|
FROM uicode
|
||||||
WHERE parent_id = 'code.record.unit'
|
WHERE parent_id = 'code.record.unit'
|
||||||
AND is_deleted = false
|
AND is_deleted = false
|
||||||
@@ -168,23 +168,22 @@
|
|||||||
fp.town,
|
fp.town,
|
||||||
fp.available_area,
|
fp.available_area,
|
||||||
fp.crop_name,
|
fp.crop_name,
|
||||||
crop_code.code_text AS crop_code_name,
|
fp.crop_code,
|
||||||
fp.land_area,
|
fp.land_area,
|
||||||
fp.main_yield,
|
fp.main_yield,
|
||||||
CASE WHEN fp.main_yield_unit_code = 'code.record.unit.self' THEN fp.main_yield_unit
|
CASE WHEN fp.main_yield_unit_code = 'code.record.unit.self' THEN fp.main_yield_unit
|
||||||
ELSE (select code_text from unit_codes where id = fp.main_yield_unit_code) END AS main_yield_unit_code_name,
|
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,
|
fp.main_sale_amount,
|
||||||
CASE WHEN fp.main_sale_unit_code = 'code.record.unit.self' THEN fp.main_sale_unit
|
CASE WHEN fp.main_sale_unit_code = 'code.record.unit.self' THEN fp.main_sale_unit
|
||||||
ELSE (select code_text from unit_codes where id = fp.main_sale_unit_code) END AS main_sale_unit_code_name,
|
ELSE (select code_value from unit_codes where id = fp.main_sale_unit_code) END AS main_sale_unit_code_name,
|
||||||
fp.sub_yield,
|
fp.sub_yield,
|
||||||
CASE WHEN fp.sub_yield_unit_code = 'code.record.unit.self' THEN fp.sub_yield_unit
|
CASE WHEN fp.sub_yield_unit_code = 'code.record.unit.self' THEN fp.sub_yield_unit
|
||||||
ELSE (select code_text from unit_codes where id = fp.sub_yield_unit_code) END AS sub_yield_unit_code_name,
|
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 ,
|
fp.sub_sale_amount ,
|
||||||
CASE WHEN fp.sub_sale_unit_code = 'code.record.unit.self' THEN fp.sub_sale_unit
|
CASE WHEN fp.sub_sale_unit_code = 'code.record.unit.self' THEN fp.sub_sale_unit
|
||||||
ELSE (select code_text from unit_codes where id = fp.sub_sale_unit_code) END AS sub_sale_unit_code_name
|
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
|
FROM forest_product fp
|
||||||
JOIN household h on fp.household_seq = h.seq and h.is_deleted = false
|
JOIN household h on fp.household_seq = h.seq and h.is_deleted = false
|
||||||
LEFT JOIN uicode crop_code on crop_code.parent_id = 'code.record.crop' and crop_code.id = fp.crop_code
|
|
||||||
WHERE fp.is_deleted = false
|
WHERE fp.is_deleted = false
|
||||||
AND fp.month = #{recordMonth}
|
AND fp.month = #{recordMonth}
|
||||||
AND fp.household_seq IN
|
AND fp.household_seq IN
|
||||||
@@ -194,7 +193,7 @@
|
|||||||
ORDER BY household_num
|
ORDER BY household_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="bankAutoTransfers"
|
<select id="bankAutoTransfersExcel"
|
||||||
resultType="app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetBankAutoTransfers">
|
resultType="app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetBankAutoTransfers">
|
||||||
/* 엑셀 다운로드 - 일계부 등록데이터 ( 2.자동이체_수입(지출) ) 조회 */
|
/* 엑셀 다운로드 - 일계부 등록데이터 ( 2.자동이체_수입(지출) ) 조회 */
|
||||||
WITH category_codes AS (
|
WITH category_codes AS (
|
||||||
@@ -209,18 +208,18 @@
|
|||||||
transfer_type.code_text as transfer_type_name,
|
transfer_type.code_text as transfer_type_name,
|
||||||
bat.income_code,
|
bat.income_code,
|
||||||
bat.expense_code,
|
bat.expense_code,
|
||||||
crop_code.code_text as crop_code_name,
|
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
|
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,
|
else (select code_text from category_codes where id = bat.transfer_category_code) END AS transfer_category_code_name,
|
||||||
bat.source_purpose,
|
bat.source_purpose,
|
||||||
bat.count,
|
bat.count,
|
||||||
unit_code.code_text as unit_code_name,
|
case when bat.unit_code = 'code.count.unit.self' then bat.unit
|
||||||
|
else unit_code.code_text end as unit_code_name,
|
||||||
bat.price
|
bat.price
|
||||||
FROM bank_auto_transfer bat
|
FROM bank_auto_transfer bat
|
||||||
JOIN household h on bat.household_seq = h.seq and h.is_deleted = false
|
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 transfer_type on transfer_type.parent_id = 'code.bank' and transfer_type.id = bat.transfer_type
|
||||||
LEFT JOIN uicode crop_code on crop_code.parent_id = 'code.record.crop' and crop_code.id = bat.crop_code
|
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
|
||||||
LEFT JOIN uicode unit_code on unit_code.parent_id = 'code.count.unit' and unit_code.id = bat.unit_code
|
|
||||||
WHERE bat.is_deleted = false
|
WHERE bat.is_deleted = false
|
||||||
AND bat.month = #{recordMonth}
|
AND bat.month = #{recordMonth}
|
||||||
AND bat.household_seq IN
|
AND bat.household_seq IN
|
||||||
@@ -229,4 +228,197 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
ORDER BY household_num
|
ORDER BY household_num
|
||||||
</select>
|
</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