[1195] 엑셀 리포트 모양 변
This commit is contained in:
parent
1dc0edb5e5
commit
6601b2a562
@ -3,7 +3,6 @@ package com.interplug.qcast.biz.estimate;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
@ -22,6 +21,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimRoofResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||
@ -1596,6 +1597,91 @@ public class EstimateService {
|
||||
|
||||
String excelTemplateNam = "excel_download_quotation_detail_template.xlsx";
|
||||
|
||||
// itemGroup이 "STAND_"가 아닌 항목들만 필터링하여 새로운 리스트 생성
|
||||
List<ItemResponse> estimateItemList15 = estimateItemList.stream()
|
||||
.filter(item -> !"STAND_".equals(item.getItemGroup()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// itemGroup이 "STAND_"인 항목들만 필터링하여 새로운 리스트 생성
|
||||
List<ItemResponse> estimateItemListS15 = estimateItemList.stream()
|
||||
.filter(item -> "STAND_".equals(item.getItemGroup()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if(estimateItemListS15.size() < 16) {
|
||||
// 15개 미만인 경우, 나머지 아이템을 빈 값으로 채움
|
||||
for (int k = estimateItemListS15.size(); k < 15; k++) {
|
||||
ItemResponse emptyItem = new ItemResponse();
|
||||
estimateItemListS15.add(emptyItem);
|
||||
}
|
||||
}else {
|
||||
// 15개 이상인 경우, 15개로 자름
|
||||
estimateItemListS15 = estimateItemListS15.subList(0, 14);
|
||||
}
|
||||
|
||||
estimateResponse.setEstimateItemListS15(estimateItemListS15);
|
||||
|
||||
|
||||
|
||||
if(estimateItemList15.size() < 16) {
|
||||
// 15개 미만인 경우, 나머지 아이템을 빈 값으로 채움
|
||||
for (int k = estimateItemList15.size(); k < 15; k++) {
|
||||
ItemResponse emptyItem = new ItemResponse();
|
||||
emptyItem.setNo(String.valueOf(k + 1));
|
||||
estimateItemList15.add(emptyItem);
|
||||
}
|
||||
}else {
|
||||
// 15개 이상인 경우, 15개로 자름
|
||||
estimateItemList15 = estimateItemList15.subList(0, 14);
|
||||
}
|
||||
|
||||
estimateResponse.setEstimateItemList15(estimateItemList15);
|
||||
|
||||
|
||||
List<ItemResponse> circuitItemList11 = estimateResponse.getRoofInfo().getCircuitItemList();
|
||||
|
||||
if (circuitItemList11.size() < 12){
|
||||
// 12개 미만인 경우, 나머지 아이템을 빈 값으로 채움
|
||||
for (int k = circuitItemList11.size(); k < 11; k++) {
|
||||
ItemResponse emptyItem = new ItemResponse();
|
||||
circuitItemList11.add(emptyItem);
|
||||
}
|
||||
}else {
|
||||
// 12개 이상인 경우, 12개로 자름
|
||||
circuitItemList11 = circuitItemList11.subList(0, 11);
|
||||
}
|
||||
estimateResponse.setCircuitItemList11(circuitItemList11);
|
||||
|
||||
// 지붕면 목록에서 8개로 자름
|
||||
List<PwrGnrSimRoofResponse> roofModuleList8 = estimateResponse.getPwrGnrSim().getRoofModuleList();
|
||||
|
||||
if (roofModuleList8.size() < 9) {
|
||||
// 9개 미만인 경우, 나머지 아이템을 빈 값으로 채움
|
||||
for (int k = roofModuleList8.size(); k < 8; k++) {
|
||||
PwrGnrSimRoofResponse emptyRoof = new PwrGnrSimRoofResponse();
|
||||
roofModuleList8.add(emptyRoof);
|
||||
}
|
||||
}else {
|
||||
// 9개 이상인 경우, 9개로 자름
|
||||
roofModuleList8 = roofModuleList8.subList(0, 8);
|
||||
}
|
||||
estimateResponse.setRoofModuleList8(roofModuleList8);
|
||||
|
||||
//pcs list 3개
|
||||
List<PwrGnrSimRoofResponse> pcsList3 = estimateResponse.getPwrGnrSim().getPcsList();
|
||||
if (pcsList3.size() < 4) {
|
||||
// 4개 미만인 경우, 나머지 아이템을 빈 값으로 채움
|
||||
for (int k = pcsList3.size(); k < 4; k++) {
|
||||
PwrGnrSimRoofResponse emptyPcs = new PwrGnrSimRoofResponse();
|
||||
pcsList3.add(emptyPcs);
|
||||
}
|
||||
|
||||
} else {
|
||||
// 4개 이상인 경우, 4개로 자름
|
||||
pcsList3 = pcsList3.subList(0, 3);
|
||||
|
||||
}
|
||||
estimateResponse.setPcsList3(pcsList3);
|
||||
|
||||
ExcelUtil excelUtil = new ExcelUtil();
|
||||
byte[] excelBytes =
|
||||
excelUtil.download(request, response, excelUtil.convertVoToMap(estimateResponse),
|
||||
|
||||
@ -3,6 +3,7 @@ package com.interplug.qcast.biz.estimate.dto;
|
||||
import java.util.List;
|
||||
import com.interplug.qcast.biz.file.dto.FileResponse;
|
||||
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimResponse;
|
||||
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimRoofResponse;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@ -282,4 +283,20 @@ public class EstimateResponse {
|
||||
|
||||
@Schema(description = "2차 SAP 판매점코드")
|
||||
private String secSapSalesStoreCd;
|
||||
|
||||
@Schema(description = "견적서 아이템 목록 15개")
|
||||
List<ItemResponse> estimateItemList15;
|
||||
|
||||
@Schema(description = "PC 회로구성도 목록 11개")
|
||||
List<ItemResponse> circuitItemList11;
|
||||
|
||||
@Schema(description = "지붕 모듈 목록 8개")
|
||||
private List<PwrGnrSimRoofResponse> roofModuleList8;
|
||||
|
||||
@Schema(description = "견적서 STAND 아이템 목록 15개")
|
||||
List<ItemResponse> estimateItemListS15;
|
||||
|
||||
@Schema(description = "PCS 목록 3개")
|
||||
List<PwrGnrSimRoofResponse> pcsList3;
|
||||
|
||||
}
|
||||
|
||||
@ -1575,6 +1575,37 @@ public class PwrGnrSimService {
|
||||
|
||||
} else {
|
||||
|
||||
// 지붕면 목록에서 8개로 자름
|
||||
List<PwrGnrSimRoofResponse> roofModuleList8 = estimateResponse.getPwrGnrSim().getRoofModuleList();
|
||||
|
||||
if (roofModuleList8.size() < 9) {
|
||||
// 9개 미만인 경우, 나머지 아이템을 빈 값으로 채움
|
||||
for (int k = roofModuleList8.size(); k < 8; k++) {
|
||||
PwrGnrSimRoofResponse emptyRoof = new PwrGnrSimRoofResponse();
|
||||
roofModuleList8.add(emptyRoof);
|
||||
}
|
||||
}else {
|
||||
// 9개 이상인 경우, 9개로 자름
|
||||
roofModuleList8 = roofModuleList8.subList(0, 8);
|
||||
}
|
||||
estimateResponse.setRoofModuleList8(roofModuleList8);
|
||||
|
||||
//pcs list 3개
|
||||
List<PwrGnrSimRoofResponse> pcsList3 = estimateResponse.getPwrGnrSim().getPcsList();
|
||||
if (pcsList3.size() < 4) {
|
||||
// 4개 미만인 경우, 나머지 아이템을 빈 값으로 채움
|
||||
for (int k = pcsList3.size(); k < 4; k++) {
|
||||
PwrGnrSimRoofResponse emptyPcs = new PwrGnrSimRoofResponse();
|
||||
pcsList3.add(emptyPcs);
|
||||
}
|
||||
|
||||
} else {
|
||||
// 4개 이상인 경우, 4개로 자름
|
||||
pcsList3 = pcsList3.subList(0, 3);
|
||||
|
||||
}
|
||||
estimateResponse.setPcsList3(pcsList3);
|
||||
|
||||
String excelTemplateName = "excel_download_simulation_detail_template.xlsx";
|
||||
|
||||
ExcelUtil excelUtil = new ExcelUtil();
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user