[BO] 임가현황 - 엑셀 다운로드 작업 중 (3)
This commit is contained in:
@@ -9,8 +9,6 @@ public enum ExcelTemplateType {
|
||||
HOUSEHOLD("임가 목록"),
|
||||
DAILY_STATUS("일계부 등록 현황"),
|
||||
VISIT("임가방문정보"),
|
||||
DAILY_RECORD("일계부 등록 데이터"),
|
||||
RESEARCHER("조사원 목록"),
|
||||
DASHBOARD("당월 대시보드");
|
||||
DAILY_RECORD("일계부 등록 데이터");
|
||||
private final String desc;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,8 @@ public class ExcelWriterUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
sheet.setColumnWidth(col, (maxLength + 2) * 256);
|
||||
// sheet.setColumnWidth(col, (maxLength + 2) * 256);
|
||||
sheet.setColumnWidth(col, Math.min((maxLength + 2) * 256, 20000)); // 최대 너비 제한
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,11 @@ package app.module.admin.usecase.dashboard.chart.adapters.persistence;
|
||||
|
||||
import app.module.admin.config.application.util.AdminUtil;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.ChartDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.DashboardExcelDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.LocalRegionPercentDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.LocalRegionResearcherPercentDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionDetailExcelDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionMainExcelDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.TotalPercentDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.web.model.TotalPercentageReqVO;
|
||||
import app.module.admin.usecase.dashboard.chart.ports.ChartPortOut;
|
||||
@@ -77,5 +80,10 @@ public class ChartDao implements ChartPortOut {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DashboardExcelDto selectDashboard(String recordMonth) {
|
||||
return new DashboardExcelDto(
|
||||
chartMapper.selectRegionMainExcel(recordMonth),
|
||||
chartMapper.selectRegionDetailExcel(recordMonth));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package app.module.admin.usecase.dashboard.chart.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.LocalRegionPercentDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.LocalRegionResearcherPercentDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionDetailExcelDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionMainExcelDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.TotalPercentDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.web.model.TotalPercentageReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
||||
@@ -16,5 +18,7 @@ public interface ChartMapper {
|
||||
TotalPercentDto selectTotalPercentageResearcher(TotalPercentageReqVO reqVO);
|
||||
List<LocalRegionPercentDto> selectLocalRegionPercentage(TotalPercentageReqVO reqVO);
|
||||
List<LocalRegionResearcherPercentDto> selectLocalRegionResearcherPercentage(TotalPercentageReqVO reqVO);
|
||||
List<RegionMainExcelDto> selectRegionMainExcel(String recordMonth);
|
||||
List<RegionDetailExcelDto> selectRegionDetailExcel(String recordMonth);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.admin.usecase.dashboard.chart.adapters.persistence.model;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class DashboardExcelDto {
|
||||
List<RegionMainExcelDto> regionMain;
|
||||
List<RegionDetailExcelDto> regionDetail;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.admin.usecase.dashboard.chart.adapters.persistence.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RegionDetailExcelDto {
|
||||
private String regionDetailName;
|
||||
private String regionName;
|
||||
private String householdCount;
|
||||
private String avgCompletionRate;
|
||||
private String visitCount;
|
||||
private String giftSentCount;
|
||||
private String regionOrder;
|
||||
private String regionDetailOrder;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.admin.usecase.dashboard.chart.adapters.persistence.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RegionMainExcelDto {
|
||||
private String regionName;
|
||||
private String researcherCount;
|
||||
private String householdCount;
|
||||
private String avgCompletionRate;
|
||||
private String visitCount;
|
||||
private String giftSentCount;
|
||||
private Integer orderNo;
|
||||
}
|
||||
@@ -1,10 +1,27 @@
|
||||
package app.module.admin.usecase.dashboard.chart.adapters.web;
|
||||
|
||||
import app.module.admin.config.application.util.DateUiUtil;
|
||||
import app.module.admin.config.application.util.ExcelWriterUtil;
|
||||
import app.module.admin.config.application.util.model.ExcelSheetDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.DashboardExcelDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionDetailExcelDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionMainExcelDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.web.model.TotalPercentageReqVO;
|
||||
import app.module.admin.usecase.dashboard.chart.ports.ChartPortIn;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -25,4 +42,65 @@ class ChartApiController {
|
||||
ResponseEntity<?> selectRegionMainCodePercentage(@RequestParam("usageType") String usageType,@RequestParam("regionMainCode") String regionMainCode) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(chartPortIn.selectRegionMainCodePercentage(usageType,regionMainCode));
|
||||
}
|
||||
|
||||
@GetMapping(path = "/excel")
|
||||
ResponseEntity<byte[]> exportDashboardExcel() {
|
||||
|
||||
DashboardExcelDto dashboardExcel = chartPortIn.selectDashboard(
|
||||
DateUiUtil.getCurrentMonthValue());
|
||||
|
||||
List<List<String>> rows1 = new ArrayList<>();
|
||||
for (RegionMainExcelDto item : dashboardExcel.getRegionMain()) {
|
||||
rows1.add(List.of(
|
||||
StringUtils.defaultString(item.getRegionName()),
|
||||
StringUtils.defaultString(item.getResearcherCount()),
|
||||
StringUtils.defaultString(item.getHouseholdCount()),
|
||||
StringUtils.defaultString(item.getAvgCompletionRate()) + "%",
|
||||
StringUtils.defaultString(item.getVisitCount()),
|
||||
StringUtils.defaultString(item.getGiftSentCount())
|
||||
));
|
||||
}
|
||||
|
||||
// 시트 1: 실사
|
||||
ExcelSheetDto sheet1 = new ExcelSheetDto(
|
||||
"실사",
|
||||
List.of("실사", "할당 조사원 수", "할당 임가 수", "일계부 진행률", "현장 방문 수", "답례품 전달 임가 수"),
|
||||
rows1,
|
||||
null,
|
||||
Map.of(0, IndexedColors.LIGHT_YELLOW)
|
||||
);
|
||||
|
||||
List<List<String>> rows2 = new ArrayList<>();
|
||||
for (RegionDetailExcelDto item : dashboardExcel.getRegionDetail()) {
|
||||
rows2.add(List.of(
|
||||
StringUtils.defaultString(item.getRegionDetailName()),
|
||||
StringUtils.defaultString(item.getHouseholdCount()),
|
||||
StringUtils.defaultString(item.getAvgCompletionRate()) + "%",
|
||||
StringUtils.defaultString(item.getVisitCount()),
|
||||
StringUtils.defaultString(item.getGiftSentCount())
|
||||
));
|
||||
}
|
||||
|
||||
// 시트 2: 세부지역
|
||||
ExcelSheetDto sheet2 = new ExcelSheetDto(
|
||||
"세부지역",
|
||||
List.of("세부지역", "할당 임가 수", "일계부 진행률", "현장 방문 수", "답례품 전달 임가 수"),
|
||||
rows2,
|
||||
null,
|
||||
Map.of(0, IndexedColors.LIGHT_YELLOW)
|
||||
);
|
||||
|
||||
// 시트 모음
|
||||
List<ExcelSheetDto> sheets = List.of(sheet1, sheet2);
|
||||
|
||||
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 ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFileName)
|
||||
.body(excel);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.admin.usecase.dashboard.chart.ports;
|
||||
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.ChartDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.DashboardExcelDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.LocalRegionResearcherPercentDto;
|
||||
|
||||
import java.util.List;
|
||||
@@ -9,6 +10,6 @@ public interface ChartPortIn {
|
||||
|
||||
ChartDto selectTotalPercentage(String usageType);
|
||||
List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,String regionMainCode);
|
||||
|
||||
DashboardExcelDto selectDashboard(String recordMonth);
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.admin.usecase.dashboard.chart.ports;
|
||||
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.ChartDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.DashboardExcelDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.LocalRegionResearcherPercentDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.web.model.TotalPercentageReqVO;
|
||||
|
||||
@@ -10,4 +11,5 @@ public interface ChartPortOut {
|
||||
|
||||
ChartDto selectTotalPercentage(String usageType);
|
||||
List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,String regionMainCode);
|
||||
DashboardExcelDto selectDashboard(String recordMonth);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.admin.usecase.dashboard.chart.ports.applilcation;
|
||||
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.ChartDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.DashboardExcelDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.LocalRegionResearcherPercentDto;
|
||||
import app.module.admin.usecase.dashboard.chart.adapters.web.model.TotalPercentageReqVO;
|
||||
import app.module.admin.usecase.dashboard.chart.ports.ChartPortIn;
|
||||
@@ -25,5 +26,10 @@ class ChartService implements ChartPortIn {
|
||||
return portOut.selectRegionMainCodePercentage(usageType,regionMainCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DashboardExcelDto selectDashboard(String recordMonth) {
|
||||
return portOut.selectDashboard(recordMonth);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ import app.module.admin.config.application.util.ExcelWriterUtil;
|
||||
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.ports.GetHouseholdsExcelPortIn;
|
||||
import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholdsExcelCmd;
|
||||
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.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.application.domain.GetHouseholdsStatus;
|
||||
@@ -37,9 +37,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
class GetHouseholdsExcelController {
|
||||
|
||||
private final GetHouseholdsStatusPortIn getHouseholdsStatusPortIn;
|
||||
private final GetHouseholdsExcelPortIn getDailyInfoExcelPortIn;
|
||||
private final GetHouseholdsExcelPortIn getHouseholdsExcelPortIn;
|
||||
|
||||
/**
|
||||
* 엑셀 다운로드 응답용 데이터 클래스.
|
||||
@@ -84,17 +83,17 @@ class GetHouseholdsExcelController {
|
||||
switch (reqVO.getTemplateType()) {
|
||||
case HOUSEHOLD -> // 임가 목록
|
||||
householdExcel(
|
||||
getDailyInfoExcelPortIn.households(
|
||||
getHouseholdsExcelPortIn.households(
|
||||
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth()))
|
||||
);
|
||||
case DAILY_STATUS -> // 일계부 등록 현황
|
||||
dailyStatusExcel(
|
||||
getDailyInfoExcelPortIn.dailyRecords(
|
||||
getHouseholdsExcelPortIn.dailyRecords(
|
||||
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth()))
|
||||
);
|
||||
case VISIT -> // 임가방문정보
|
||||
visitExcel(
|
||||
getDailyInfoExcelPortIn.visitInfos(
|
||||
getHouseholdsExcelPortIn.visitInfos(
|
||||
new GetHouseholdsExcelCmd(householdSeqList, reqVO.getRecordMonth()))
|
||||
);
|
||||
case DAILY_RECORD -> // 일계부 등록 데이터
|
||||
@@ -136,7 +135,7 @@ class GetHouseholdsExcelController {
|
||||
StringUtils.defaultString(item.getIndustryDetail()),
|
||||
StringUtils.defaultString(item.getResearcherName()),
|
||||
StringUtils.defaultString(item.getResearcherPhone()),
|
||||
StringUtils.defaultString(item.getCompletionRate()),
|
||||
StringUtils.defaultString(item.getCompletionRate()) + "%",
|
||||
StringUtils.defaultString(item.getFirstVisitDate()),
|
||||
StringUtils.defaultString(item.getSecondVisitDate()),
|
||||
StringUtils.defaultString(item.getGiftSend()),
|
||||
@@ -199,12 +198,13 @@ class GetHouseholdsExcelController {
|
||||
StringUtils.defaultString(item.getRegionDetailCodeText()),
|
||||
StringUtils.defaultString(item.getResearcherName()),
|
||||
StringUtils.defaultString(item.getResearcherPhone()),
|
||||
StringUtils.defaultString(item.getDayGroup()),
|
||||
StringUtils.defaultString(item.getStartDay()),
|
||||
StringUtils.defaultString(item.getEndDay()),
|
||||
StringUtils.defaultString(item.getAllStatusType().getDesc()),
|
||||
StringUtils.defaultString(item.getIncomeStatus()),
|
||||
StringUtils.defaultString(item.getWorkStatus()),
|
||||
StringUtils.defaultString(item.getExpenseStatus()),
|
||||
StringUtils.defaultString(item.getWorkStatus()),
|
||||
StringUtils.defaultString(item.getPowerStatus()),
|
||||
StringUtils.defaultString(item.getForestryStatus()),
|
||||
StringUtils.defaultString(item.getFarmingStatus())
|
||||
));
|
||||
@@ -218,10 +218,12 @@ class GetHouseholdsExcelController {
|
||||
"연령",
|
||||
"연락처",
|
||||
"실사",
|
||||
"지역",
|
||||
"세부지역",
|
||||
"조사원",
|
||||
"조사원 연락처",
|
||||
"입력 날짜",
|
||||
"날",
|
||||
"짜",
|
||||
"완료상태",
|
||||
"수입",
|
||||
"노동투입",
|
||||
@@ -264,7 +266,7 @@ class GetHouseholdsExcelController {
|
||||
item.getManagementType() != null ? ManagementType.valueOf(item.getManagementType()).getDesc() : "",
|
||||
StringUtils.defaultString(item.getContent()),
|
||||
StringUtils.defaultString(item.getUpdatedBy()),
|
||||
StringUtils.defaultString(item.getUpdatedAt()),
|
||||
StringUtils.defaultString(item.getCreatedAt()),
|
||||
item.getIsGiftSent() ? "전달 완료" : "-"
|
||||
));
|
||||
}
|
||||
@@ -277,6 +279,7 @@ class GetHouseholdsExcelController {
|
||||
"연령",
|
||||
"연락처",
|
||||
"실사",
|
||||
"지역",
|
||||
"세부지역",
|
||||
"조사원",
|
||||
"조사원 연락처",
|
||||
|
||||
@@ -7,10 +7,10 @@ import app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports
|
||||
import java.util.List;
|
||||
|
||||
public interface GetHouseholdsExcelPortIn {
|
||||
// 01. 임가 목록
|
||||
// 임가 목록
|
||||
List<GetHouseholds> households(GetHouseholdsExcelCmd cmd);
|
||||
// 02. 일계부 등록 현황
|
||||
// 일계부 등록 현황
|
||||
List<GetDailyRecords> dailyRecords(GetHouseholdsExcelCmd cmd);
|
||||
// 03. 임가방문정보
|
||||
// 임가방문정보
|
||||
List<GetVisitInfos> visitInfos(GetHouseholdsExcelCmd cmd);
|
||||
}
|
||||
@@ -23,6 +23,8 @@ public class GetDailyRecords {
|
||||
private String researcherPhone;
|
||||
private Integer dayGroupNo;
|
||||
private String dayGroup;
|
||||
private String startDay;
|
||||
private String endDay;
|
||||
private RecordStatusType allStatusType;
|
||||
private String incomeStatus;
|
||||
private String workStatus;
|
||||
|
||||
@@ -24,5 +24,5 @@ public class GetVisitInfos {
|
||||
private String content;
|
||||
private Boolean isGiftSent;
|
||||
private String updatedBy;
|
||||
private String updatedAt;
|
||||
private String createdAt;
|
||||
}
|
||||
|
||||
@@ -1,31 +1,15 @@
|
||||
package app.module.admin.usecase.household.getHouseholdsStatus.adapters.web;
|
||||
|
||||
import app.module.admin.config.application.enums.ManagementType;
|
||||
import app.module.admin.config.application.enums.UsageType;
|
||||
import app.module.admin.config.application.util.AdminUtil;
|
||||
import app.module.admin.config.application.util.ExcelWriterUtil;
|
||||
import app.module.admin.config.application.util.model.ExcelSheetDto;
|
||||
import app.module.admin.usecase.household.getHouseholdsStatus.adapters.web.model.GetHouseholdsStatusReqVO;
|
||||
import app.module.admin.usecase.household.getHouseholdsStatus.ports.GetHouseholdsStatusPortIn;
|
||||
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatusCmd;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -33,13 +17,13 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class GetHouseholdsStatusController {
|
||||
private final GetHouseholdsStatusPortIn portIn;
|
||||
private final GetHouseholdsStatusPortIn getHouseholdsStatusPortIn;
|
||||
|
||||
@GetMapping(path = "/api/households")
|
||||
ResponseEntity<Page<GetHouseholdsStatus>> operate(@PageableDefault(size = 10) Pageable pageable,
|
||||
GetHouseholdsStatusReqVO reqVO) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(
|
||||
portIn.operate(pageable,
|
||||
getHouseholdsStatusPortIn.operate(pageable,
|
||||
new GetHouseholdsStatusCmd(
|
||||
reqVO.getRecordMonth(),
|
||||
reqVO.getOwnerField(),
|
||||
@@ -61,103 +45,4 @@ class GetHouseholdsStatusController {
|
||||
reqVO.getUserRegionMainCode(),
|
||||
Boolean.TRUE)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 임가현황 엑셀 다운로드
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 엑셀 파일 다운로드
|
||||
*/
|
||||
@GetMapping(path = "/api/households/excel")
|
||||
ResponseEntity<byte[]> exportHouseholdsExcel(Pageable pageable,
|
||||
GetHouseholdsStatusReqVO reqVO) {
|
||||
|
||||
Page<GetHouseholdsStatus> households =
|
||||
portIn.operate(pageable,
|
||||
new GetHouseholdsStatusCmd(
|
||||
reqVO.getRecordMonth(),
|
||||
reqVO.getOwnerField(),
|
||||
reqVO.getOwnerValue(),
|
||||
reqVO.getRegionMainCode(),
|
||||
reqVO.getRegionSubCode(),
|
||||
reqVO.getRegionDetailCode(),
|
||||
reqVO.getIndustryLargeCode(),
|
||||
reqVO.getIndustryMiddleCode(),
|
||||
reqVO.getProgressType() != null ? reqVO.getProgressType().name() : null,
|
||||
reqVO.getIsFirstVisited(),
|
||||
reqVO.getIsSecondVisited(),
|
||||
reqVO.getIsGiftSent(),
|
||||
reqVO.getResearcherField(),
|
||||
reqVO.getResearcherValue(),
|
||||
reqVO.getIsPanel(),
|
||||
AdminUtil.getLoginUserSeq(),
|
||||
reqVO.getUserRole(),
|
||||
reqVO.getUserRegionMainCode(),
|
||||
Boolean.FALSE)); // 임가 전체 목록을 가져온다.
|
||||
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
for(GetHouseholdsStatus item : households.getContent()) {
|
||||
rows.add(List.of(
|
||||
item.getHouseholdNum(),
|
||||
item.getHouseholdName(),
|
||||
StringUtils.defaultString(item.getOwnerAge().toString()),
|
||||
StringUtils.defaultString(item.getHouseholdPhone()),
|
||||
StringUtils.defaultString(item.getRegionMainName()),
|
||||
StringUtils.defaultString(item.getRegionSubName()),
|
||||
StringUtils.defaultString(item.getRegionDetailName()),
|
||||
StringUtils.defaultString(item.getAddress()),
|
||||
StringUtils.defaultString(item.getIndustryLargeName()),
|
||||
StringUtils.defaultString(item.getIndustryMiddleName()),
|
||||
StringUtils.defaultString(item.getIndustrySubMiddle()),
|
||||
StringUtils.defaultString(item.getIndustryDetail()),
|
||||
StringUtils.defaultString(item.getProgressPercent().toString()) + "%",
|
||||
StringUtils.defaultString(item.getFirstVisitDate()),
|
||||
StringUtils.defaultString(item.getSecondVisitDate()),
|
||||
item.getIsGiftSent() ? "전달" : "미전달",
|
||||
StringUtils.defaultString(item.getResearcherName()),
|
||||
StringUtils.defaultString(item.getResearcherPhone()),
|
||||
item.getUsageType() != null ? UsageType.valueOf(item.getUsageType()).getDesc() : "",
|
||||
item.getIsPanel() ? "1. 유지" : "2. 탈락"
|
||||
));
|
||||
}
|
||||
|
||||
// 시트 1: 임가 목록
|
||||
ExcelSheetDto sheet1 = new ExcelSheetDto("임가 목록",
|
||||
List.of(
|
||||
"임가번호",
|
||||
"경영주 성명",
|
||||
"연령",
|
||||
"연락처",
|
||||
"실사",
|
||||
"지역",
|
||||
"세부지역",
|
||||
"전체 주소",
|
||||
"업종_대분류",
|
||||
"업종_중분류1",
|
||||
"업종_중분류2",
|
||||
"규모/세부품목",
|
||||
"당월 일계부 현황",
|
||||
"당월 1차 임가방문",
|
||||
"당월 2차 임가방문",
|
||||
"답례품 전달",
|
||||
"조사원",
|
||||
"조사원 연락처",
|
||||
"이용 구분",
|
||||
"유지여부"),
|
||||
rows,
|
||||
null,
|
||||
Map.of(0, IndexedColors.LIGHT_YELLOW));
|
||||
|
||||
List<ExcelSheetDto> sheets = List.of(sheet1);
|
||||
|
||||
byte[] excel = ExcelWriterUtil.writeExcel(sheets);
|
||||
|
||||
String rawFileName = "01. 임가 목록[" + reqVO.getRecordMonth() + "]_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx";
|
||||
String encodedFileName = URLEncoder.encode(rawFileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20");
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFileName)
|
||||
.body(excel);
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,7 @@ class ResearcherApiController {
|
||||
StringUtils.defaultString(item.getName()),
|
||||
StringUtils.defaultString(item.getPhone()),
|
||||
StringUtils.defaultString(item.getRegionMainCodeName()),
|
||||
item.getHouseholdCount() > 0 ? item.getHouseholdCount().toString() : "-",
|
||||
StringUtils.defaultString(item.getAccountDisabledFlag())
|
||||
));
|
||||
}
|
||||
@@ -102,7 +103,7 @@ class ResearcherApiController {
|
||||
// 시트 1: 조사원 목록
|
||||
ExcelSheetDto sheet1 = new ExcelSheetDto(
|
||||
"조사원 목록",
|
||||
List.of("아이디", "이름", "전화번호", "실사", "사용여부"),
|
||||
List.of("아이디", "이름", "전화번호", "실사", "담당 임가 수", "사용여부"),
|
||||
rows,
|
||||
null,
|
||||
Map.of(0, IndexedColors.LIGHT_YELLOW)
|
||||
@@ -113,7 +114,7 @@ class ResearcherApiController {
|
||||
|
||||
byte[] excel = ExcelWriterUtil.writeExcel(sheets);
|
||||
|
||||
String rawFileName = "07. 조사원 목록" + "_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx";
|
||||
String rawFileName = "조사원 목록_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx";
|
||||
String encodedFileName = URLEncoder.encode(rawFileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20");
|
||||
|
||||
return ResponseEntity.ok()
|
||||
@@ -230,7 +231,7 @@ class ResearcherApiController {
|
||||
|
||||
byte[] excel = ExcelWriterUtil.writeExcel(sheets);
|
||||
|
||||
String rawFileName = "06. 임가방문정보" + "_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx";
|
||||
String rawFileName = "임가방문정보_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx";
|
||||
String encodedFileName = URLEncoder.encode(rawFileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20");
|
||||
|
||||
return ResponseEntity.ok()
|
||||
|
||||
@@ -103,4 +103,144 @@
|
||||
</if>
|
||||
GROUP BY a.seq,u.id
|
||||
</select>
|
||||
|
||||
<select id="selectRegionMainExcel"
|
||||
resultType="app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionMainExcelDto">
|
||||
/* selectRegionMainExcel : 대시보드 엑셀다운로드 (실사) */
|
||||
SELECT
|
||||
u.code_text AS region_name,
|
||||
COUNT(DISTINCT a.seq) AS researcher_count,
|
||||
COUNT(DISTINCT rhh.household_seq) AS household_count,
|
||||
CASE
|
||||
WHEN COALESCE(AVG(v.completion_rate), 0) > 0 THEN ROUND(COALESCE(AVG(v.completion_rate), 0), 1)
|
||||
ELSE 0
|
||||
END AS avg_completion_rate,
|
||||
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END) AS visit_count,
|
||||
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS gift_sent_count,
|
||||
u.order_no
|
||||
FROM uicode u
|
||||
LEFT JOIN admin a
|
||||
ON a.region_main_code = u.id
|
||||
AND a.is_deleted = false
|
||||
LEFT JOIN admin_has_role ahr
|
||||
ON a.seq = ahr.admin_seq
|
||||
AND ahr.is_deleted = false
|
||||
AND ahr.role_id = 'ROLE_RESEARCHER'
|
||||
LEFT JOIN researcher_has_household rhh
|
||||
ON rhh.admin_seq = a.seq
|
||||
AND rhh.is_deleted = false
|
||||
LEFT JOIN household h
|
||||
ON h.seq = rhh.household_seq
|
||||
AND h.is_deleted = false
|
||||
AND h.is_panel = true
|
||||
LEFT JOIN household_visit hv
|
||||
ON hv.household_seq = h.seq
|
||||
AND hv.is_deleted = false
|
||||
LEFT JOIN v_monthly_completion_rate v
|
||||
ON v.household_seq = h.seq
|
||||
AND v.record_month = #{recordMonth}
|
||||
WHERE u.parent_id = 'code.region.main'
|
||||
GROUP BY u.code_text, u.order_no
|
||||
UNION ALL
|
||||
-- 전체 합계 행
|
||||
SELECT
|
||||
'전체' AS region_name,
|
||||
COUNT(DISTINCT a.seq),
|
||||
COUNT(DISTINCT rhh.household_seq),
|
||||
COALESCE(ROUND(AVG(v.completion_rate), 1), 0),
|
||||
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END),
|
||||
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END),
|
||||
-1 as order_no
|
||||
FROM uicode u
|
||||
LEFT JOIN admin a
|
||||
ON a.region_main_code = u.id
|
||||
AND a.is_deleted = false
|
||||
LEFT JOIN admin_has_role ahr
|
||||
ON a.seq = ahr.admin_seq
|
||||
AND ahr.is_deleted = false
|
||||
AND ahr.role_id = 'ROLE_RESEARCHER'
|
||||
LEFT JOIN researcher_has_household rhh
|
||||
ON rhh.admin_seq = a.seq
|
||||
AND rhh.is_deleted = false
|
||||
LEFT JOIN household h
|
||||
ON h.seq = rhh.household_seq
|
||||
AND h.is_deleted = false
|
||||
AND h.is_panel = true
|
||||
LEFT JOIN household_visit hv
|
||||
ON hv.household_seq = h.seq
|
||||
AND hv.is_deleted = false
|
||||
LEFT JOIN v_monthly_completion_rate v
|
||||
ON v.household_seq = h.seq
|
||||
AND v.record_month = #{recordMonth}
|
||||
WHERE u.parent_id = 'code.region.main'
|
||||
ORDER BY order_no
|
||||
</select>
|
||||
|
||||
<select id="selectRegionDetailExcel"
|
||||
resultType="app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionDetailExcelDto">
|
||||
/* selectRegionDetailExcel : 대시보드 엑셀다운로드 (세부지역) */
|
||||
-- 세부 지역별 데이터
|
||||
SELECT
|
||||
detail_uicode.code_text AS region_detail_name,
|
||||
parent_uicode.code_text AS region_name,
|
||||
COUNT(DISTINCT h.seq) AS household_count,
|
||||
CASE
|
||||
WHEN AVG(v.completion_rate) > 0 THEN ROUND(AVG(v.completion_rate), 1)
|
||||
ELSE 0
|
||||
END AS avg_completion_rate,
|
||||
COUNT(DISTINCT hv_visit.household_seq) AS visit_count,
|
||||
COUNT(DISTINCT hv_gift.household_seq) AS gift_sent_count,
|
||||
parent_uicode.order_no AS region_order,
|
||||
detail_uicode.order_no AS region_detail_order
|
||||
FROM uicode detail_uicode
|
||||
LEFT JOIN uicode parent_uicode ON parent_uicode.id = detail_uicode.parent_id
|
||||
LEFT JOIN household h
|
||||
ON h.region_detail_code = detail_uicode.id
|
||||
AND h.is_deleted = false
|
||||
AND h.is_panel = true
|
||||
LEFT JOIN v_monthly_completion_rate v
|
||||
ON v.household_seq = h.seq
|
||||
AND v.record_month = #{recordMonth}
|
||||
LEFT JOIN household_visit hv_visit
|
||||
ON hv_visit.household_seq = h.seq
|
||||
AND hv_visit.is_deleted = false
|
||||
AND TO_CHAR(hv_visit.visit_date, 'YYYYMM') = #{recordMonth}
|
||||
LEFT JOIN household_visit hv_gift
|
||||
ON hv_gift.household_seq = h.seq
|
||||
AND hv_gift.is_deleted = false
|
||||
AND hv_gift.is_gift_sent = true
|
||||
WHERE detail_uicode.id LIKE 'code.region.detail.%'
|
||||
GROUP BY
|
||||
detail_uicode.code_text,
|
||||
parent_uicode.code_text,
|
||||
parent_uicode.order_no,
|
||||
detail_uicode.order_no
|
||||
UNION ALL
|
||||
-- 전체 합계 행
|
||||
SELECT
|
||||
'전체' AS region_detail_name,
|
||||
'전체' AS region_name,
|
||||
COUNT(DISTINCT h.seq) AS household_count,
|
||||
COALESCE(ROUND(AVG(v.completion_rate), 1), 0),
|
||||
COUNT(DISTINCT hv_visit.household_seq),
|
||||
COUNT(DISTINCT hv_gift.household_seq),
|
||||
-1 AS region_order,
|
||||
-1 AS region_detail_order
|
||||
FROM household h
|
||||
LEFT JOIN v_monthly_completion_rate v
|
||||
ON v.household_seq = h.seq
|
||||
AND v.record_month = #{recordMonth}
|
||||
LEFT JOIN household_visit hv_visit
|
||||
ON hv_visit.household_seq = h.seq
|
||||
AND hv_visit.is_deleted = false
|
||||
AND TO_CHAR(hv_visit.visit_date, 'YYYYMM') = #{recordMonth}
|
||||
LEFT JOIN household_visit hv_gift
|
||||
ON hv_gift.household_seq = h.seq
|
||||
AND hv_gift.is_deleted = false
|
||||
AND hv_gift.is_gift_sent = true
|
||||
WHERE h.is_deleted = false AND h.is_panel = true
|
||||
order by
|
||||
region_order ASC,
|
||||
region_detail_order ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -5,7 +5,7 @@
|
||||
namespace="app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.adapters.persistence.GetHouseholdsExcelMapper">
|
||||
<select id="households"
|
||||
resultType="app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetHouseholds">
|
||||
/* 엑셀 다운로드 - 임가 현황 (01. 임가 목록) 조회 */
|
||||
/* 엑셀 다운로드 - 임가 현황 (임가 목록) 조회 */
|
||||
SELECT
|
||||
vha.household_num
|
||||
, vha.owner_name AS household_name
|
||||
@@ -21,7 +21,10 @@
|
||||
, vha.industry_detail
|
||||
, vha.researcher_name
|
||||
, vha.researcher_phone
|
||||
, vmcr.completion_rate
|
||||
, CASE
|
||||
WHEN vmcr.completion_rate = 0 THEN 0
|
||||
ELSE ROUND(vmcr.completion_rate, 1)
|
||||
END AS completion_rate
|
||||
, vhvs.first_visit_date
|
||||
, vhvs.second_visit_date
|
||||
, CASE WHEN vhvs.gift_send = true THEN '전달' ELSE '' END AS gift_send
|
||||
@@ -70,7 +73,7 @@
|
||||
h.household_num,
|
||||
h.owner_name,
|
||||
h.owner_age,
|
||||
h.phone,
|
||||
h.phone AS householdPhone,
|
||||
h.region_main_code_text,
|
||||
h.region_sub_code_text,
|
||||
h.region_detail_code_text,
|
||||
@@ -82,12 +85,17 @@
|
||||
WHEN ddg.start_day = LEAST(ddg.end_day, mc.month_last_day) THEN ''
|
||||
ELSE '-' || LEAST(ddg.end_day, mc.month_last_day)
|
||||
END AS day_group,
|
||||
ddg.start_day AS start_day,
|
||||
CASE
|
||||
WHEN ddg.start_day = LEAST(ddg.end_day, mc.month_last_day) THEN ''
|
||||
ELSE LEAST(ddg.end_day, mc.month_last_day)::TEXT
|
||||
END AS end_day,
|
||||
CASE
|
||||
WHEN mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE) THEN 'WAITING'
|
||||
WHEN dr.all_status IN ('DONE', 'TODAY_NONE') THEN 'DONE'
|
||||
WHEN dr.all_status = 'WAITING' THEN 'INCOMPLETE'
|
||||
ELSE 'EMPTY'
|
||||
END AS all_status,
|
||||
END AS all_status_type,
|
||||
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.income_status, dc.income_cnt) AS income_status,
|
||||
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.work_status, dc.work_cnt) AS work_status,
|
||||
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.expense_status, dc.expense_cnt) AS expense_status,
|
||||
@@ -133,7 +141,7 @@
|
||||
content,
|
||||
is_gift_sent,
|
||||
updated_by,
|
||||
created_at
|
||||
TO_CHAR(created_at, 'YYYY-MM-DD HH24:MI') AS created_at
|
||||
FROM v_household_all_visit
|
||||
WHERE visit_month = #{recordMonth}
|
||||
AND seq IN
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -136,6 +136,15 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<div class="btns-col-2">
|
||||
<button type="button" class="btn" onclick="goExcel();">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="component-input sms-check" th:if="${loginUserRoles.id == 'ROLE_ADMIN'}">
|
||||
<label class="switch-inner">
|
||||
@@ -446,6 +455,11 @@
|
||||
{ handle422Type: 'alert' }
|
||||
);
|
||||
}
|
||||
|
||||
// 엑셀 다운로드
|
||||
const goExcel = () => {
|
||||
excelDownload('/api/dashboard/chart/excel', null);
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@
|
||||
<button type="button" class="btn" onclick="showExcelHouseholdModal();">
|
||||
<span class="btn-txt">엑셀 업로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
<button type="button" class="btn" onclick="goExcel();">
|
||||
<button type="button" class="btn" onclick="showExcelDownloadModal();">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
<!-- 관리자만 노출 -->
|
||||
@@ -294,6 +294,7 @@
|
||||
|
||||
<div th:replace="common/modal-researcher-mapping :: modalFragment"></div>
|
||||
<div th:replace="households/modal/modal-excel-household :: modalFragment"></div>
|
||||
<div th:replace="households/modal/modal-excel-download :: modalFragment"></div>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
@@ -484,24 +485,6 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 엑셀 다운로드
|
||||
const goExcel = () => {
|
||||
const url = '/api/excel/household';
|
||||
const f = document.reqForm;
|
||||
const data = $(f).serializeObject();
|
||||
|
||||
// 선택된 엑셀 템플릿 파일 항목
|
||||
data.templateType = '';
|
||||
|
||||
if (url !== '') {
|
||||
excelDownload(url, data);
|
||||
} else {
|
||||
console.warn('엑셀 다운르도 경로 없음.');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 체크박스 전체 선택
|
||||
document.getElementById('checkedAll').addEventListener('change', function () {
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<div class="layer-wrap" th:fragment="modalFragment">
|
||||
<div class="component-modal mypage-wrap modal01 modal-excel-download" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
<div class="modal-frame">
|
||||
<div class="modal-container type-small">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-tit">
|
||||
엑셀 다운로드
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-content">
|
||||
<div class="modal-content-inner">
|
||||
<div class="form-area">
|
||||
<!-- 파일선택 -->
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt">
|
||||
파일선택
|
||||
</p>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="templateType" required>
|
||||
<option value="" disabled hidden selected>선택</option>
|
||||
<option value="HOUSEHOLD">임가목록</option>
|
||||
<option value="DAILY_STATUS">일계부 등록 현황</option>
|
||||
<option value="VISIT">임가방문정보</option>
|
||||
<option value="DAILY_RECORD">일계부 등록 데이터</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-primary" onclick="goExcel();">
|
||||
<span class="btn-txt">다운로드</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<button class="modal-close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 엑셀 다운로드 팝업 띄우기
|
||||
const showExcelDownloadModal= () => {
|
||||
document.querySelector(".modal-excel-download").ui.open();
|
||||
}
|
||||
|
||||
// 엑셀 다운로드
|
||||
const goExcel = () => {
|
||||
const templateType = $('select[name=templateType]').val();
|
||||
console.log("templateType", templateType);
|
||||
const url = '/api/excel/household';
|
||||
const f = document.reqForm;
|
||||
const data = $(f).serializeObject();
|
||||
|
||||
if(templateType === null) {
|
||||
alert('파일을 선택해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
// 선택된 엑셀 템플릿 파일 항목
|
||||
data.templateType = templateType;
|
||||
|
||||
if (url !== '') {
|
||||
excelDownload(url, data);
|
||||
} else {
|
||||
console.warn('엑셀 다운르도 경로 없음.');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</html>
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="component-modal mypage-wrap modal01 modal-excel-household" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
<div class="modal-frame">
|
||||
<div class="modal-container">
|
||||
<div class="modal-container type-small">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-tit">
|
||||
임가 등록 엑셀업로드
|
||||
|
||||
@@ -603,7 +603,7 @@
|
||||
|
||||
$('#expenseCount').text(data.length);
|
||||
if(data.length === 0) {
|
||||
noDataDaily(tbody, status, 9);
|
||||
noDataDaily(tbody, status, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,26 +158,26 @@
|
||||
</div>
|
||||
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row two-col">
|
||||
<div class="btns-row align-right">
|
||||
<div class="btns-col-1">
|
||||
<button type="button" class="btn" onclick="location.href='/households'">
|
||||
<span class="btn-txt">목록</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="btns-col-2 align-right _excelDownload" th:unless="${activeProfile != 'local'}">
|
||||
<button type="button" class="btn" data-tab-type="daily-record" data-tab-value="tab1" onclick="goExcel(this)">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
<button type="button" class="btn" data-tab-type="forest-product" data-tab-value="tab2" onclick="goExcel(this)">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
<button type="button" class="btn" data-tab-type="bank-auto-transfer" data-tab-value="tab3" onclick="goExcel(this)">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
<button type="button" class="btn" data-tab-type="household-visit" data-tab-value="tab4" onclick="goExcel(this)">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<!-- <div class="btns-col-2 align-right _excelDownload" th:unless="${activeProfile != 'local'}">-->
|
||||
<!-- <button type="button" class="btn" data-tab-type="daily-record" data-tab-value="tab1" onclick="goExcel(this)">-->
|
||||
<!-- <span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>-->
|
||||
<!-- </button>-->
|
||||
<!-- <button type="button" class="btn" data-tab-type="forest-product" data-tab-value="tab2" onclick="goExcel(this)">-->
|
||||
<!-- <span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>-->
|
||||
<!-- </button>-->
|
||||
<!-- <button type="button" class="btn" data-tab-type="bank-auto-transfer" data-tab-value="tab3" onclick="goExcel(this)">-->
|
||||
<!-- <span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>-->
|
||||
<!-- </button>-->
|
||||
<!-- <button type="button" class="btn" data-tab-type="household-visit" data-tab-value="tab4" onclick="goExcel(this)">-->
|
||||
<!-- <span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>-->
|
||||
<!-- </button>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -161,17 +161,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row two-col">
|
||||
<div class="btns-row align-right">
|
||||
<div class="btns-col-1">
|
||||
<button type="button" class="btn" onclick="location.href='/researcher/researchers'">
|
||||
<span class="btn-txt">목록</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="btns-col-2 align-right" th:unless="${activeProfile != 'local'}">
|
||||
<button type="button" class="btn" onclick="goExcel();">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user