Merge branch 'dev' into feature/qcast-250
This commit is contained in:
commit
f4d4760385
26
pom.xml
26
pom.xml
@ -160,6 +160,32 @@
|
||||
<version>1.0.9</version>
|
||||
</dependency>
|
||||
|
||||
<!--pdf-->
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.18.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>html2pdf</artifactId>
|
||||
<version>4.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>kernel</artifactId>
|
||||
<version>7.2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>layout</artifactId>
|
||||
<version>7.2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>io</artifactId>
|
||||
<version>7.2.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -9,6 +9,9 @@ public class ItemResponse {
|
||||
@Schema(description = "Itme Id")
|
||||
private String itemId;
|
||||
|
||||
@Schema(description = "Item No")
|
||||
private String itemNo;
|
||||
|
||||
@Schema(description = "Item Name")
|
||||
private String itemName;
|
||||
|
||||
|
||||
@ -21,15 +21,27 @@ public interface EstimateMapper {
|
||||
// 아이템 마스터 목록 조회
|
||||
public List<ItemResponse> selectItemMasterList(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 지붕재 인증용량 조회
|
||||
public String selectEstimateRoofCertVolKw(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 지붕재 목록 조회
|
||||
public List<RoofResponse> selectEstimateRoofList(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 지붕재 PC 목록 조회
|
||||
public List<RoofResponse> selectEstimateRoofPcList(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 지붕재 용량 목록 조회
|
||||
public List<RoofResponse> selectEstimateRoofVolList(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 특이사항 목록 조회
|
||||
public List<NoteResponse> selectEstimateNoteList(NoteRequest noteRequest);
|
||||
|
||||
// 아이템 마스터 목록 조회
|
||||
public List<NoteResponse> selectEstimateNoteItemList(NoteRequest noteRequest);
|
||||
|
||||
// 아이템 히스토리 번호 조회
|
||||
public String selectEstimateItemHisNo(EstimateRequest estimateRequest);
|
||||
|
||||
// 물건정보 수정
|
||||
public int updateObject(EstimateRequest estimateRequest);
|
||||
|
||||
@ -48,6 +60,9 @@ public interface EstimateMapper {
|
||||
// 견적서 아이템 등록
|
||||
public int insertEstimateItem(ItemRequest itemRequest);
|
||||
|
||||
// 견적서 아이템 히스토리 등록
|
||||
public int insertEstimateItemHis(ItemRequest itemRequest);
|
||||
|
||||
// 견적서 지붕재 목록 삭제(물리 삭제)
|
||||
public int deleteEstimateRoofList(EstimateRequest estimateRequest);
|
||||
|
||||
|
||||
@ -10,26 +10,31 @@ import com.interplug.qcast.biz.object.dto.ObjectResponse;
|
||||
import com.interplug.qcast.biz.object.dto.PlanRequest;
|
||||
import com.interplug.qcast.biz.object.dto.PlanResponse;
|
||||
import com.interplug.qcast.biz.pwrGnrSimulation.PwrGnrSimService;
|
||||
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimGuideResponse;
|
||||
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimRequest;
|
||||
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimResponse;
|
||||
import com.interplug.qcast.config.Exception.ErrorCode;
|
||||
import com.interplug.qcast.config.Exception.QcastException;
|
||||
import com.interplug.qcast.config.message.Messages;
|
||||
import com.interplug.qcast.util.ExcelUtil;
|
||||
import com.interplug.qcast.util.InterfaceQsp;
|
||||
import com.interplug.qcast.util.PdfUtil;
|
||||
import io.micrometer.common.util.StringUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpMethod;
|
||||
@ -357,6 +362,8 @@ public class EstimateService {
|
||||
itemRequest.setFileUploadFlg(itemResponse.getFileUploadFlg());
|
||||
itemRequest.setPkgMaterialFlg(itemResponse.getPkgMaterialFlg());
|
||||
itemRequest.setItemGroup(itemResponse.getItemGroup());
|
||||
itemRequest.setPartAdd("0");
|
||||
itemRequest.setDelFlg("0");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -508,11 +515,13 @@ public class EstimateService {
|
||||
estimateMapper.deleteEstimateItemList(estimateRequest);
|
||||
|
||||
// 견적서 아이템 신규 추가
|
||||
int j = 1;
|
||||
String hisNo = estimateMapper.selectEstimateItemHisNo(estimateRequest); // 아이템 히스토리 번호 조회
|
||||
int j = 1, k = 1;
|
||||
for (ItemRequest itemRequest : itemList) {
|
||||
itemRequest.setHisNo(hisNo);
|
||||
itemRequest.setObjectNo(estimateRequest.getObjectNo());
|
||||
itemRequest.setPlanNo(estimateRequest.getPlanNo());
|
||||
itemRequest.setDispOrder(String.valueOf(j++));
|
||||
itemRequest.setDispOrder(String.valueOf(k++));
|
||||
itemRequest.setPartAdd(
|
||||
!StringUtils.isEmpty(itemRequest.getPartAdd()) ? itemRequest.getPartAdd() : "0");
|
||||
itemRequest.setItemChangeFlg(
|
||||
@ -521,7 +530,13 @@ public class EstimateService {
|
||||
: "0");
|
||||
itemRequest.setUserId(estimateRequest.getUserId());
|
||||
|
||||
estimateMapper.insertEstimateItem(itemRequest);
|
||||
estimateMapper.insertEstimateItemHis(itemRequest);
|
||||
|
||||
if (!"1".equals(itemRequest.getDelFlg())) {
|
||||
itemRequest.setDispOrder(String.valueOf(j++));
|
||||
|
||||
estimateMapper.insertEstimateItem(itemRequest);
|
||||
}
|
||||
}
|
||||
|
||||
// QSP Q.CAST SEND API
|
||||
@ -685,7 +700,30 @@ public class EstimateService {
|
||||
// 지붕재 목록 조회
|
||||
RoofInfoResponse roofInfoResponse = new RoofInfoResponse();
|
||||
List<RoofResponse> roofList = estimateMapper.selectEstimateRoofList(estimateRequest);
|
||||
List<RoofResponse> roofPcList = estimateMapper.selectEstimateRoofPcList(estimateRequest);
|
||||
estimateRequest.setSchItemGroup("MODULE_");
|
||||
List<RoofResponse> roofVolList = estimateMapper.selectEstimateRoofVolList(estimateRequest);
|
||||
|
||||
BigDecimal moduleTotAmount = BigDecimal.ZERO;
|
||||
BigDecimal moduleTotVolKw = BigDecimal.ZERO;
|
||||
for (RoofResponse roofVol : roofVolList) {
|
||||
BigDecimal amount =
|
||||
new BigDecimal(StringUtils.isEmpty(roofVol.getAmount()) ? "0" : roofVol.getAmount());
|
||||
BigDecimal vol =
|
||||
new BigDecimal(StringUtils.isEmpty(roofVol.getVolKw()) ? "0" : roofVol.getVolKw());
|
||||
|
||||
moduleTotAmount = moduleTotAmount.add(amount);
|
||||
moduleTotVolKw = moduleTotVolKw.add(vol);
|
||||
}
|
||||
roofInfoResponse.setModuleTotAmount(String.valueOf(moduleTotAmount));
|
||||
roofInfoResponse.setModuleTotVolKw(String.valueOf(moduleTotVolKw));
|
||||
|
||||
roofInfoResponse.setRoofList(roofList);
|
||||
roofInfoResponse.setRoofPcList(roofPcList);
|
||||
roofInfoResponse.setRoofVolList(roofVolList);
|
||||
|
||||
// 인증용량 구하기 (지붕면마다 모듈과 PCS의 총 용량을 서로 비교해 낮은쪽 용량으로 합산)
|
||||
roofInfoResponse.setCertVolKw(estimateMapper.selectEstimateRoofCertVolKw(estimateRequest));
|
||||
|
||||
estimateResponse.setRoofInfo(roofInfoResponse);
|
||||
|
||||
@ -734,19 +772,14 @@ public class EstimateService {
|
||||
estimateResponse.setTotPrice(
|
||||
String.format("%1$,.0f", Double.parseDouble(estimateResponse.getTotPrice())));
|
||||
|
||||
String excelFileName = "Quation_Detail";
|
||||
String excelTemplatePath =
|
||||
excelTemplateFilePath + File.separator + "excel_download_quotation_detail_template.xlsx";
|
||||
|
||||
// 발전시뮬레이션 계산
|
||||
PwrGnrSimRequest pwrGnrSimRequest = new PwrGnrSimRequest();
|
||||
pwrGnrSimRequest.setObjectNo(estimateResponse.getObjectNo());
|
||||
pwrGnrSimRequest.setPlanNo(estimateResponse.getPlanNo());
|
||||
/*
|
||||
|
||||
PwrGnrSimResponse pwrGnrSimResponse =
|
||||
pwrGnrSimService.selectPwrGnrSimulation(pwrGnrSimRequest);
|
||||
if (pwrGnrSimResponse != null) {
|
||||
|
||||
try {
|
||||
// 발전시뮬레이션 안내사항 조회
|
||||
PwrGnrSimGuideResponse pwrGnrSimGuideInfo =
|
||||
@ -755,20 +788,52 @@ public class EstimateService {
|
||||
pwrGnrSimResponse.setGuideInfo(pwrGnrSimGuideInfo.getData());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
estimateResponse.setPwrGnrSim(pwrGnrSimResponse);
|
||||
*/
|
||||
|
||||
excelUtil.download(
|
||||
request,
|
||||
response,
|
||||
this.convertVoToMap(estimateResponse),
|
||||
this.convertListToMap(estimateItemList),
|
||||
excelFileName,
|
||||
excelTemplatePath);
|
||||
if (true) { // PDF 다운로드
|
||||
String[] arrSection = new String[3]; // TODO Section 갯수 넣기
|
||||
int iSection = 0;
|
||||
|
||||
String pdfFileName =
|
||||
"Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
String templateFilePath = "pdf_download_quotation_detail_template.html";
|
||||
|
||||
// 템플릿 html 조회
|
||||
Document doc = PdfUtil.getPdfDoc(request, templateFilePath);
|
||||
|
||||
// 삭제하려는 element
|
||||
Element elm;
|
||||
|
||||
// 발전시뮬레이션 pdf Html 생성
|
||||
if (true) {
|
||||
arrSection[iSection] = "div.section3";
|
||||
iSection++;
|
||||
doc = pwrGnrSimService.pwrGnrSimPdfHtml(doc, pwrGnrSimResponse);
|
||||
} else {
|
||||
elm = doc.getElementsByClass("section3").first();
|
||||
elm.remove();
|
||||
}
|
||||
|
||||
// pdf 다운로드
|
||||
PdfUtil.pdfDownload(request, response, doc, pdfFileName, arrSection);
|
||||
|
||||
} else {
|
||||
|
||||
String excelFileName =
|
||||
"Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
String excelTemplateNam = "excel_download_quotation_detail_template.xlsx";
|
||||
|
||||
excelUtil.download(
|
||||
request,
|
||||
response,
|
||||
this.convertVoToMap(estimateResponse),
|
||||
this.convertListToMap(estimateItemList),
|
||||
excelFileName,
|
||||
excelTemplateNam);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@ -163,18 +163,21 @@ public class EstimateRequest {
|
||||
private String[] arrItemId;
|
||||
|
||||
// 다운로드 관련 조건
|
||||
@Schema(description = "다운로드 정가 표시여부")
|
||||
@Schema(description = "검색 - 다운로드 정가 표시여부")
|
||||
private String schUnitPriceFlg;
|
||||
|
||||
@Schema(description = "다운로드 표시여부")
|
||||
@Schema(description = "검색 - 다운로드 표시여부")
|
||||
private String schDisplayFlg;
|
||||
|
||||
@Schema(description = "가대중량표 포함 여부")
|
||||
@Schema(description = "검색 - 가대중량표 포함 여부")
|
||||
private String schWeightFlg;
|
||||
|
||||
@Schema(description = "도면 포함 여부")
|
||||
@Schema(description = "검색 - 도면 포함 여부")
|
||||
private String schDrawingFlg;
|
||||
|
||||
@Schema(description = "검색 - 아이템 그룹")
|
||||
private String schItemGroup;
|
||||
|
||||
// 데이터 목록 관련 정보
|
||||
@Schema(description = "지붕재 목록")
|
||||
List<RoofRequest> roofList;
|
||||
|
||||
@ -71,6 +71,12 @@ public class ItemRequest {
|
||||
@Schema(description = "아이템 그룹코드")
|
||||
private String itemGroup;
|
||||
|
||||
@Schema(description = "히스토리 번호")
|
||||
private String hisNo;
|
||||
|
||||
@Schema(description = "삭제여부")
|
||||
private String delFlg;
|
||||
|
||||
@Schema(description = "사용자아이디")
|
||||
private String userId;
|
||||
}
|
||||
|
||||
@ -9,6 +9,15 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class RoofInfoResponse {
|
||||
@Schema(description = "인증용량")
|
||||
private String certVolKw;
|
||||
|
||||
@Schema(description = "모듈 총 수")
|
||||
private String moduleTotAmount;
|
||||
|
||||
@Schema(description = "모듈 총 용량")
|
||||
private String moduleTotVolKw;
|
||||
|
||||
@Schema(description = "지붕면 목록")
|
||||
private List<RoofResponse> roofList;
|
||||
|
||||
|
||||
@ -64,4 +64,19 @@ public class RoofResponse {
|
||||
|
||||
@Schema(description = "설치높이")
|
||||
private String setupHeight;
|
||||
|
||||
@Schema(description = "아이템 ID")
|
||||
private String itemId;
|
||||
|
||||
@Schema(description = "아이템 번호")
|
||||
private String itemNo;
|
||||
|
||||
@Schema(description = "매수")
|
||||
private String amount;
|
||||
|
||||
@Schema(description = "용량")
|
||||
private String volKw;
|
||||
|
||||
@Schema(description = "Pc 모듈 매수")
|
||||
private String pcModuleAmount;
|
||||
}
|
||||
|
||||
@ -337,8 +337,41 @@ public class ObjectService {
|
||||
message.getMessage("common.message.required.data", "Object No"));
|
||||
}
|
||||
|
||||
// 물건정보 삭제
|
||||
result = objectMapper.deleteObject(objectRequest);
|
||||
// object 상세 정보 조회
|
||||
ObjectResponse objectResponse = objectMapper.selectObjectDetail(objectRequest.getObjectNo());
|
||||
if (objectResponse != null) {
|
||||
// 설계의뢰 번호가 존재하고 물건정보에 견적서가 없을 경우 QSP 설계의뢰 물건번호 초기화
|
||||
if (!StringUtils.isEmpty(objectResponse.getPlanReqNo())
|
||||
&& objectResponse.getEstimateTotCnt() == 0) {
|
||||
PlanReqResponse response = null;
|
||||
|
||||
PlanReqRequest planReqRequest = new PlanReqRequest();
|
||||
planReqRequest.setSaleStoreId(objectResponse.getSaleStoreId());
|
||||
planReqRequest.setSaleStoreLevel(objectResponse.getSaleStoreLevel());
|
||||
planReqRequest.setObjectNo(objectResponse.getObjectNo());
|
||||
planReqRequest.setPlanReqNo(objectResponse.getPlanReqNo());
|
||||
planReqRequest.setDelFlg("1");
|
||||
|
||||
String strResponse =
|
||||
interfaceQsp.callApi(
|
||||
HttpMethod.POST, QSP_API_URL + "/api/planReq/updateObjectNo", planReqRequest);
|
||||
if (!"".equals(strResponse)) {
|
||||
com.fasterxml.jackson.databind.ObjectMapper om =
|
||||
new com.fasterxml.jackson.databind.ObjectMapper()
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
response = om.readValue(strResponse, PlanReqResponse.class);
|
||||
|
||||
Map<String, Object> map = (Map<String, Object>) response.getResult();
|
||||
if ("E".equals(String.valueOf(map.get("resultCode")))) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INTERNAL_SERVER_ERROR, String.valueOf(map.get("resultMsg")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 물건정보 삭제
|
||||
result = objectMapper.deleteObject(objectRequest);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -125,6 +125,9 @@ public class ObjectResponse {
|
||||
@Schema(description = "플랜 전체 건수")
|
||||
private String planTotCnt;
|
||||
|
||||
@Schema(description = "견적서 전체 건수")
|
||||
private Integer estimateTotCnt;
|
||||
|
||||
// 플랜목록
|
||||
@Schema(description = "플랜목록")
|
||||
private List<PlanResponse> planList;
|
||||
|
||||
@ -17,6 +17,9 @@ public class PlanReqRequest {
|
||||
@Schema(description = "물건번호")
|
||||
private String objectNo;
|
||||
|
||||
@Schema(description = "삭제여부")
|
||||
private String delFlg;
|
||||
|
||||
@Schema(description = "검색 - 설계의뢰번호")
|
||||
private String schPlanReqNo;
|
||||
|
||||
|
||||
@ -7,19 +7,24 @@ import com.interplug.qcast.config.Exception.ErrorCode;
|
||||
import com.interplug.qcast.config.Exception.QcastException;
|
||||
import com.interplug.qcast.config.message.Messages;
|
||||
import com.interplug.qcast.util.InterfaceQsp;
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -1303,4 +1308,180 @@ public class PwrGnrSimService {
|
||||
|
||||
return guideResponse;
|
||||
}
|
||||
|
||||
public static Document pwrGnrSimPdfHtml(Document doc, PwrGnrSimResponse data)
|
||||
throws IOException, QcastException {
|
||||
Element elm;
|
||||
|
||||
// 상단 요약정보
|
||||
elm = doc.getElementById("objectNo");
|
||||
elm.text(
|
||||
ObjectUtils.nullSafeToString(data.getObjectNo() + " (Plan No : " + data.getPlanNo() + ")"));
|
||||
|
||||
elm = doc.getElementById("drawingEstimateCreateDate");
|
||||
elm.text(ObjectUtils.nullSafeToString(data.getDrawingEstimateCreateDate()));
|
||||
|
||||
elm = doc.getElementById("prefName");
|
||||
elm.text(ObjectUtils.nullSafeToString(data.getPrefName()));
|
||||
|
||||
elm = doc.getElementById("areaName");
|
||||
elm.text(ObjectUtils.nullSafeToString(data.getAreaName()));
|
||||
|
||||
elm = doc.getElementById("capacity");
|
||||
elm.text(ObjectUtils.nullSafeToString(data.getCapacity()));
|
||||
|
||||
elm = doc.getElementById("anlFrcsGnrt");
|
||||
elm.text(ObjectUtils.nullSafeToString(data.getAnlFrcsGnrt()));
|
||||
|
||||
elm = doc.getElementById("snowfall");
|
||||
elm.text(ObjectUtils.nullSafeToString(data.getSnowfall()));
|
||||
|
||||
elm = doc.getElementById("standardWindSpeedId");
|
||||
elm.text(ObjectUtils.nullSafeToString(data.getStandardWindSpeedId()));
|
||||
|
||||
if (data.getFrcPwrGnrList() != null && data.getFrcPwrGnrList().length > 0) {
|
||||
|
||||
int[] onlyData =
|
||||
Arrays.copyOfRange(data.getFrcPwrGnrList(), 0, data.getFrcPwrGnrList().length - 1);
|
||||
|
||||
int referenceValue = 300; // table 높이
|
||||
int orgMaxValue =
|
||||
Arrays.stream(onlyData)
|
||||
.max()
|
||||
.orElseThrow(() -> new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, "배열이 없음"));
|
||||
int maxValue = roundUpAuto(orgMaxValue / 8);
|
||||
|
||||
// chart y축
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 8; i >= 1; i--) {
|
||||
sb.append("<tr>");
|
||||
sb.append("<td ")
|
||||
.append(i == 8 ? "class='top'" : "")
|
||||
.append(">")
|
||||
.append(maxValue * i)
|
||||
.append("</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
sb.append("<tr>");
|
||||
sb.append("<td class='zero'>0</td>");
|
||||
elm = doc.getElementById("htmlY");
|
||||
elm.append(sb.toString());
|
||||
|
||||
// chart 데이터
|
||||
String[] color = {
|
||||
"#B5D4F5", "#FFE899", "#FBC3AB", "#D1D1D1", "#FFE899", "#B5D0F0", "#C1E4B8", "#A3C9EE",
|
||||
"#F7BBA2", "#BEBEBE", "#A8BBE0", "#B5D7A3"
|
||||
};
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
for (int i = 0; i < onlyData.length; i++) {
|
||||
double scaledValues = ((double) onlyData[i] / (maxValue * 8)) * referenceValue;
|
||||
|
||||
sb2.append("<td class='bar-cell'>");
|
||||
|
||||
sb2.append("<table class='chart-line' style='border-collapse: collapse;'>")
|
||||
.append("<tbody>")
|
||||
.append("<tr>")
|
||||
.append("<td class='top' style='border-bottom: 1px solid #ddd;'></td>")
|
||||
.append("</tr>")
|
||||
.append("<tr>")
|
||||
.append("<td style='border-bottom: 1px solid #ddd;'></td>")
|
||||
.append("</tr>")
|
||||
.append("<tr>")
|
||||
.append("<td style='border-bottom: 1px solid #ddd;'></td>")
|
||||
.append("</tr>")
|
||||
.append("<tr>")
|
||||
.append("<td style='border-bottom: 1px solid #ddd;'></td>")
|
||||
.append("</tr>")
|
||||
.append("<tr>")
|
||||
.append("<td style='border-bottom: 1px solid #ddd;'></td>")
|
||||
.append("</tr>")
|
||||
.append("<tr>")
|
||||
.append("<td style='border-bottom: 1px solid #ddd;'></td>")
|
||||
.append("</tr>")
|
||||
.append("<tr>")
|
||||
.append("<td style='border-bottom: 1px solid #ddd;'></td>")
|
||||
.append("</tr>")
|
||||
.append("<tr>")
|
||||
.append("<td style='border-bottom: 1px solid #ddd;'></td>")
|
||||
.append("</tr>")
|
||||
.append("<tr>")
|
||||
.append("<td style='border-bottom: 1px solid #ddd;'></td>")
|
||||
.append("</tr>")
|
||||
.append("</tbody>")
|
||||
.append("</table>");
|
||||
|
||||
sb2.append(
|
||||
"<div class='bar' style='height: "
|
||||
+ scaledValues
|
||||
+ "px; background-color: "
|
||||
+ color[i]
|
||||
+ "'></div>");
|
||||
sb2.append("</td>");
|
||||
}
|
||||
elm = doc.getElementById("htmlX");
|
||||
elm.append(sb2.toString());
|
||||
}
|
||||
|
||||
// 예측발전량
|
||||
if (data.getFrcPwrGnrList() != null && data.getFrcPwrGnrList().length > 0) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < 13; i++) {
|
||||
sb.append("<td>" + ObjectUtils.nullSafeToString(data.getFrcPwrGnrList()[i]) + "</td>");
|
||||
}
|
||||
|
||||
elm = doc.getElementById("frcPwrGnrList_detail");
|
||||
elm.append(sb.toString());
|
||||
}
|
||||
|
||||
// 모듈 list
|
||||
if (data.getRoofModuleList() != null && data.getRoofModuleList().size() > 0) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < data.getRoofModuleList().size(); i++) {
|
||||
PwrGnrSimRoofResponse listItem = data.getRoofModuleList().get(i);
|
||||
|
||||
sb.append("<tr>");
|
||||
sb.append("<td>" + ObjectUtils.nullSafeToString(listItem.getRoofSurface()) + "</td>");
|
||||
sb.append(
|
||||
"<td>"
|
||||
+ Optional.ofNullable(listItem.getSlope()).orElse("")
|
||||
+ ""
|
||||
+ Optional.ofNullable(listItem.getAngle()).orElse("")
|
||||
+ "</td>");
|
||||
sb.append("<td>" + ObjectUtils.nullSafeToString(listItem.getAzimuth()) + "</td>");
|
||||
sb.append("<td>" + ObjectUtils.nullSafeToString(listItem.getItemNo()) + "</td>");
|
||||
sb.append("<td>" + ObjectUtils.nullSafeToString(listItem.getAmount()) + "</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
|
||||
elm = doc.getElementById("roofModuleList_detail");
|
||||
elm.append(sb.toString());
|
||||
}
|
||||
|
||||
// pcs list
|
||||
if (data.getPcsList() != null && data.getPcsList().size() > 0) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < data.getPcsList().size(); i++) {
|
||||
PwrGnrSimRoofResponse listItem = data.getPcsList().get(i);
|
||||
|
||||
sb.append("<tr>");
|
||||
sb.append("<td>" + ObjectUtils.nullSafeToString(listItem.getItemNo()) + "</td>");
|
||||
sb.append("<td>" + ObjectUtils.nullSafeToString(listItem.getAmount()) + "</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
|
||||
elm = doc.getElementById("pcsList_detail");
|
||||
elm.append(sb.toString());
|
||||
}
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
public static int roundUpAuto(double value) {
|
||||
int length = (int) Math.log10(value) + 1; // 숫자의 자리수를 계산
|
||||
int place = (int) Math.pow(10, length - 1); // 자리수에 따른 올림 기준(10, 100, 1000 등)
|
||||
|
||||
return (int) Math.ceil(value / place) * place;
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,9 @@ public class ExcelUtil {
|
||||
* @param map 엑셀 출력데이터
|
||||
* @param list 엑셀 출력 목록 데이터
|
||||
* @param fileName 다운로드 파일명
|
||||
* @param templateFilePath 템플릿 파일경로
|
||||
* @param templateFileName
|
||||
* @throws ParsePropertyException
|
||||
* @throws InvalidFormatException
|
||||
*/
|
||||
public void download(
|
||||
HttpServletRequest request,
|
||||
@ -34,10 +36,15 @@ public class ExcelUtil {
|
||||
Map<String, Object> map,
|
||||
List<Map<String, Object>> list,
|
||||
String fileName,
|
||||
String templateFilePath)
|
||||
String templateFileName)
|
||||
throws ParsePropertyException, InvalidFormatException {
|
||||
try {
|
||||
InputStream is = new BufferedInputStream(new FileInputStream(templateFilePath));
|
||||
|
||||
String templateFilePath = "template/excel/" + templateFileName;
|
||||
InputStream templateStream =
|
||||
PdfUtil.class.getClassLoader().getResourceAsStream(templateFilePath);
|
||||
|
||||
InputStream is = new BufferedInputStream(templateStream);
|
||||
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + ".xlsx\"");
|
||||
|
||||
|
||||
163
src/main/java/com/interplug/qcast/util/PdfUtil.java
Normal file
163
src/main/java/com/interplug/qcast/util/PdfUtil.java
Normal file
@ -0,0 +1,163 @@
|
||||
package com.interplug.qcast.util;
|
||||
|
||||
import com.itextpdf.html2pdf.ConverterProperties;
|
||||
import com.itextpdf.html2pdf.HtmlConverter;
|
||||
import com.itextpdf.html2pdf.resolver.font.DefaultFontProvider;
|
||||
import com.itextpdf.kernel.pdf.PdfDocument;
|
||||
import com.itextpdf.kernel.pdf.PdfReader;
|
||||
import com.itextpdf.kernel.pdf.PdfWriter;
|
||||
import com.itextpdf.kernel.utils.PdfMerger;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class PdfUtil {
|
||||
// HTML 템플릿 파일 경로
|
||||
// @Value("${file.excel.template.path}")
|
||||
// private String excelTemplateFilePath;
|
||||
|
||||
/**
|
||||
* 파일 템플릿 HTML 불러오기
|
||||
*
|
||||
* @param request
|
||||
* @param templateFileName
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static Document getPdfDoc(HttpServletRequest request, String templateFileName)
|
||||
throws IOException {
|
||||
|
||||
String templateFilePath = "template/pdf/" + templateFileName;
|
||||
InputStream templateStream =
|
||||
PdfUtil.class.getClassLoader().getResourceAsStream(templateFilePath);
|
||||
|
||||
if (templateStream == null) {
|
||||
throw new FileNotFoundException("Template file not found: " + templateFilePath);
|
||||
}
|
||||
|
||||
Document doc = Jsoup.parse(templateStream, StandardCharsets.UTF_8.name(), "");
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
/**
|
||||
* PDF 다운로드
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param doc
|
||||
* @param pdfFileName 파일명
|
||||
* @param arrSection 노출 Section
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void pdfDownload(
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
Document doc,
|
||||
String pdfFileName,
|
||||
String[] arrSection)
|
||||
throws IOException {
|
||||
|
||||
// 응답에 PDF 설정
|
||||
response.setContentType("application/pdf");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + pdfFileName + "\"");
|
||||
|
||||
try (OutputStream os = response.getOutputStream();
|
||||
PdfWriter writer = new PdfWriter(os);
|
||||
PdfDocument pdfDoc = new PdfDocument(writer)) {
|
||||
|
||||
// 폰트 설정
|
||||
ConverterProperties properties = new ConverterProperties();
|
||||
String fontPath = "template/pdf/BIZUDPGothic-Regular.ttf";
|
||||
properties.setFontProvider(setFontProvider(fontPath));
|
||||
|
||||
// arrSection이 비어 있는 경우 HTML 전체를 변환
|
||||
if (arrSection == null || arrSection.length == 0) {
|
||||
// HTML 전체를 pdfDoc에 직접 변환
|
||||
HtmlConverter.convertToPdf(
|
||||
new ByteArrayInputStream(doc.html().getBytes(StandardCharsets.UTF_8)), os, properties);
|
||||
os.flush();
|
||||
} else {
|
||||
// arrSection이 있는 경우 각 섹션을 개별적으로 변환 후 병합
|
||||
String headHtml = doc.select("head").outerHtml();
|
||||
|
||||
PdfMerger merger = new PdfMerger(pdfDoc);
|
||||
for (String section : arrSection) {
|
||||
if (section != null && !"".equals(section)) {
|
||||
Elements eSections = doc.select(section);
|
||||
if (eSections != null && eSections.size() > 0) {
|
||||
for (Element eSection : eSections) {
|
||||
|
||||
String sectionHtml =
|
||||
"<html>" + headHtml + "<body>" + eSection.outerHtml() + "</body></html>";
|
||||
|
||||
try (ByteArrayOutputStream tempOutputStream = new ByteArrayOutputStream();
|
||||
PdfWriter tempWriter = new PdfWriter(tempOutputStream);
|
||||
PdfDocument tempPdfDoc = new PdfDocument(tempWriter)) {
|
||||
|
||||
HtmlConverter.convertToPdf(
|
||||
new ByteArrayInputStream(sectionHtml.getBytes(StandardCharsets.UTF_8)),
|
||||
tempPdfDoc,
|
||||
properties);
|
||||
|
||||
PdfDocument tempDoc =
|
||||
new PdfDocument(
|
||||
new PdfReader(new ByteArrayInputStream(tempOutputStream.toByteArray())));
|
||||
merger.merge(tempDoc, 1, tempDoc.getNumberOfPages());
|
||||
tempDoc.close();
|
||||
|
||||
if (!eSection.equals(eSections.last())) {
|
||||
pdfDoc.addNewPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pdfDoc.close();
|
||||
os.flush();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("PDF 생성 중 오류 발생: " + e.getMessage(), e);
|
||||
if (!response.isCommitted()) {
|
||||
response.reset();
|
||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "PDF 생성 중 오류가 발생했습니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 폰트 설정 메서드
|
||||
*
|
||||
* @param fontPath 폰트 파일 경로
|
||||
* @return 설정된 FontProvider
|
||||
*/
|
||||
private static DefaultFontProvider setFontProvider(String fontPath) throws IOException {
|
||||
DefaultFontProvider fontProvider = new DefaultFontProvider(false, false, false);
|
||||
InputStream fontStream = PdfUtil.class.getClassLoader().getResourceAsStream(fontPath);
|
||||
|
||||
if (fontStream != null) {
|
||||
File tempFontFile = Files.createTempFile("BIZUDPGothic-Regular", ".ttf").toFile();
|
||||
Files.copy(
|
||||
fontStream, tempFontFile.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
|
||||
fontProvider.addFont(tempFontFile.getAbsolutePath());
|
||||
fontStream.close();
|
||||
tempFontFile.deleteOnExit();
|
||||
} else {
|
||||
log.error("폰트 파일을 찾을 수 없습니다: " + fontPath);
|
||||
}
|
||||
return fontProvider;
|
||||
}
|
||||
}
|
||||
@ -50,6 +50,7 @@
|
||||
FROM (
|
||||
SELECT /* 전체 목록중 미표시 제품 */
|
||||
MI.ITEM_ID
|
||||
, MI.ITEM_NO
|
||||
, MI.ITEM_NAME
|
||||
, MI.DISP_ORDER
|
||||
FROM M_ITEM MI
|
||||
@ -66,6 +67,7 @@
|
||||
|
||||
SELECT /* 미표시 제품 중 판매점만 표시 */
|
||||
MI.ITEM_ID
|
||||
, MI.ITEM_NO
|
||||
, MI.ITEM_NAME
|
||||
, MI.DISP_ORDER
|
||||
FROM M_SALES_STORE_DISP_ITEM SSDI
|
||||
@ -84,10 +86,11 @@
|
||||
/* sqlid : com.interplug.qcast.displayItem.getItemDetail */
|
||||
SELECT
|
||||
MI.ITEM_ID
|
||||
, MI.ITEM_NO
|
||||
, MI.ITEM_NAME
|
||||
, MI.GOODS_NO
|
||||
, MI.UNIT
|
||||
, MI.SPECIFICATION
|
||||
, MI.PNOW_W AS SPECIFICATION
|
||||
, MI.PNOW_W
|
||||
, MI.ITEM_GROUP
|
||||
, MI.MODULE_FLG
|
||||
|
||||
@ -120,7 +120,7 @@
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateApiDetail" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.EstimateSendResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateDetail */
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateApiDetail */
|
||||
SELECT
|
||||
O.OBJECT_NO
|
||||
, O.SALE_STORE_ID
|
||||
@ -215,18 +215,60 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateRoofCertVolKw" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="String">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateRoofCertVolKw */
|
||||
SELECT
|
||||
FORMAT(ISNULL(SUM(CASE WHEN T.MODULE_VOL_KW <![CDATA[ <= ]]> T.PC_VOL_KW THEN T.MODULE_VOL_KW ELSE T.PC_VOL_KW END), 0), '#,##0.000') AS CERT_VOL_KW
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
P.OBJECT_NO
|
||||
, P.PLAN_NO
|
||||
, RE.ROOF_NO
|
||||
, RE.ROOF_SURFACE
|
||||
, ROUND(CAST(RE.SLOPE AS FLOAT), 2) AS SLOPE
|
||||
, RIE.AMOUNT
|
||||
, CAST(RIE.SPECIFICATION AS FLOAT) SPECIFICATION
|
||||
, ROUND((RIE.AMOUNT * CAST(ISNULL(RIE.SPECIFICATION, 0) AS FLOAT) / 1000), 4) AS PC_VOL_KW
|
||||
, I.ITEM_ID
|
||||
, I.ITEM_NO
|
||||
, ISNULL((
|
||||
SELECT
|
||||
SUM((AMOUNT * CAST(ISNULL(SPECIFICATION, 0) AS FLOAT) / 1000))
|
||||
FROM T_ROOF_ITEM_ESTIMATE
|
||||
WHERE ROOF_NO = RIE.ROOF_NO
|
||||
AND OBJECT_NO = RIE.OBJECT_NO
|
||||
AND PLAN_NO = RIE.PLAN_NO
|
||||
AND PC_ITEM_ID = RIE.ITEM_ID
|
||||
), 0) AS MODULE_VOL_KW
|
||||
FROM T_PLAN P WITH (NOLOCK)
|
||||
INNER JOIN T_ROOF_ESTIMATE RE WITH (NOLOCK)
|
||||
ON P.OBJECT_NO = RE.OBJECT_NO
|
||||
AND P.PLAN_NO = RE.PLAN_NO
|
||||
INNER JOIN T_ROOF_ITEM_ESTIMATE RIE WITH (NOLOCK)
|
||||
ON RE.ROOF_NO = RIE.ROOF_NO
|
||||
AND RE.OBJECT_NO = RE.OBJECT_NO
|
||||
AND RE.PLAN_NO = RE.PLAN_NO
|
||||
INNER JOIN M_ITEM I WITH (NOLOCK)
|
||||
ON RIE.ITEM_ID = I.ITEM_ID
|
||||
WHERE P.OBJECT_NO = #{objectNo}
|
||||
AND P.PLAN_NO = #{planNo}
|
||||
AND I.ITEM_GROUP = 'PC_'
|
||||
) T
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateRoofList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.RoofResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateRoofList */
|
||||
SELECT
|
||||
P.OBJECT_NO
|
||||
, P.PLAN_NO
|
||||
, P.SETUP_HEIGHT
|
||||
, ROUND(CAST(P.SETUP_HEIGHT AS FLOAT), 2) AS SETUP_HEIGHT
|
||||
, P.SURFACE_TYPE
|
||||
, RE.ROOF_SURFACE
|
||||
, RE.ROOF_MATERIAL_ID
|
||||
, RE.SUPPORT_METHOD_ID
|
||||
, RE.CONSTRUCT_SPECIFICATION
|
||||
, RE.SLOPE
|
||||
, ROUND(CAST(RE.SLOPE AS FLOAT), 2) AS SLOPE
|
||||
, RE.ANGLE
|
||||
, RE.AZIMUTH
|
||||
, ISNULL(C1.CODE_NM, '') AS ROOF_MATERIAL_NAME
|
||||
@ -249,6 +291,85 @@
|
||||
AND P.PLAN_NO = #{planNo}
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateRoofPcList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.RoofResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateRoofPcList */
|
||||
SELECT
|
||||
T.ITEM_ID
|
||||
, T.ITEM_NO
|
||||
, SUM(T.AMOUNT) AS AMOUNT
|
||||
, SUM(T.PC_AMOUNT) AS PC_MODULE_AMOUNT
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
P.OBJECT_NO
|
||||
, P.PLAN_NO
|
||||
, RE.ROOF_NO
|
||||
, RE.ROOF_SURFACE
|
||||
, ROUND(CAST(RE.SLOPE AS FLOAT), 2) AS SLOPE
|
||||
, RIE.AMOUNT
|
||||
, CAST(RIE.SPECIFICATION AS FLOAT) SPECIFICATION
|
||||
, I.ITEM_ID
|
||||
, I.ITEM_NO
|
||||
, I.ITEM_GROUP
|
||||
, (SELECT SUM(AMOUNT) FROM T_ROOF_ITEM_ESTIMATE WHERE ROOF_NO = RIE.ROOF_NO AND OBJECT_NO = RIE.OBJECT_NO AND PLAN_NO = RIE.PLAN_NO AND PC_ITEM_ID = RIE.ITEM_ID) AS PC_AMOUNT
|
||||
FROM T_PLAN P WITH (NOLOCK)
|
||||
INNER JOIN T_ROOF_ESTIMATE RE WITH (NOLOCK)
|
||||
ON P.OBJECT_NO = RE.OBJECT_NO
|
||||
AND P.PLAN_NO = RE.PLAN_NO
|
||||
INNER JOIN T_ROOF_ITEM_ESTIMATE RIE WITH (NOLOCK)
|
||||
ON RE.ROOF_NO = RIE.ROOF_NO
|
||||
AND RE.OBJECT_NO = RE.OBJECT_NO
|
||||
AND RE.PLAN_NO = RE.PLAN_NO
|
||||
INNER JOIN M_ITEM I WITH (NOLOCK)
|
||||
ON RIE.ITEM_ID = I.ITEM_ID
|
||||
WHERE P.OBJECT_NO = #{objectNo}
|
||||
AND P.PLAN_NO = #{planNo}
|
||||
AND I.ITEM_GROUP = 'PC_'
|
||||
) T
|
||||
GROUP BY T.ITEM_ID, T.ITEM_NO
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateRoofVolList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.RoofResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateRoofVolList */
|
||||
SELECT
|
||||
T.OBJECT_NO
|
||||
, T.PLAN_NO
|
||||
, T.ROOF_NO
|
||||
, T.ROOF_SURFACE
|
||||
, T.SLOPE
|
||||
, SUM(T.AMOUNT) AS AMOUNT
|
||||
, ROUND(SUM(T.AMOUNT * T.SPECIFICATION / 1000), 4) AS VOL_KW
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
P.OBJECT_NO
|
||||
, P.PLAN_NO
|
||||
, RE.ROOF_NO
|
||||
, RE.ROOF_SURFACE
|
||||
, ROUND(CAST(RE.SLOPE AS FLOAT), 2) AS SLOPE
|
||||
, RIE.AMOUNT
|
||||
, CAST(RIE.SPECIFICATION AS FLOAT) SPECIFICATION
|
||||
, I.ITEM_ID
|
||||
, I.ITEM_GROUP
|
||||
FROM T_PLAN P WITH (NOLOCK)
|
||||
INNER JOIN T_ROOF_ESTIMATE RE WITH (NOLOCK)
|
||||
ON P.OBJECT_NO = RE.OBJECT_NO
|
||||
AND P.PLAN_NO = RE.PLAN_NO
|
||||
INNER JOIN T_ROOF_ITEM_ESTIMATE RIE WITH (NOLOCK)
|
||||
ON RE.ROOF_NO = RIE.ROOF_NO
|
||||
AND RE.OBJECT_NO = RE.OBJECT_NO
|
||||
AND RE.PLAN_NO = RE.PLAN_NO
|
||||
INNER JOIN M_ITEM I WITH (NOLOCK)
|
||||
ON RIE.ITEM_ID = I.ITEM_ID
|
||||
WHERE P.OBJECT_NO = #{objectNo}
|
||||
AND P.PLAN_NO = #{planNo}
|
||||
<if test='schItemGroup != null and schItemGroup != ""'>
|
||||
AND I.ITEM_GROUP = #{schItemGroup}
|
||||
</if>
|
||||
) T
|
||||
GROUP BY T.OBJECT_NO, T.PLAN_NO, T.ROOF_NO, T.ROOF_SURFACE, T.SLOPE
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateNoteList" parameterType="com.interplug.qcast.biz.estimate.dto.NoteRequest" resultType="com.interplug.qcast.biz.estimate.dto.NoteResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateNoteList */
|
||||
SELECT
|
||||
@ -298,6 +419,15 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateItemHisNo" parameterType="com.interplug.qcast.biz.estimate.dto.NoteRequest" resultType="String">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateItemHisNo */
|
||||
SELECT
|
||||
ISNULL(MAX(PEH.HIS_NO), 0) + 1 AS HIS_NO
|
||||
FROM T_PART_ESTIMATE_HIS PEH WITH (NOLOCK)
|
||||
WHERE PEH.OBJECT_NO = #{objectNo}
|
||||
AND PEH.PLAN_NO = #{planNo}
|
||||
</select>
|
||||
|
||||
<update id="updateObject" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.updateObject */
|
||||
UPDATE T_OBJECT
|
||||
@ -439,6 +569,56 @@
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertEstimateItemHis" parameterType="com.interplug.qcast.biz.estimate.dto.ItemRequest">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.insertEstimateItemHits */
|
||||
INSERT INTO T_PART_ESTIMATE_HIS
|
||||
(
|
||||
HIS_NO
|
||||
, OBJECT_NO
|
||||
, PLAN_NO
|
||||
, DISP_ORDER
|
||||
, ITEM_ID
|
||||
, ITEM_NO
|
||||
, ITEM_NAME
|
||||
, UNIT
|
||||
, AMOUNT
|
||||
, UNIT_PRICE
|
||||
, SALE_PRICE
|
||||
<if test='specialNoteCd != null and specialNoteCd != ""'>
|
||||
, SPECIAL_NOTE_CD
|
||||
</if>
|
||||
, PKG_MATERIAL_FLG
|
||||
, ITEM_CHANGE_FLG
|
||||
, FILE_UPLOAD_FLG
|
||||
, PART_ADD
|
||||
, DEL_FLG
|
||||
, CREATE_DATETIME
|
||||
, CREATE_USER
|
||||
) VALUES (
|
||||
#{hisNo}
|
||||
, #{objectNo}
|
||||
, #{planNo}
|
||||
, #{dispOrder}
|
||||
, #{itemId}
|
||||
, #{itemNo}
|
||||
, #{itemName}
|
||||
, #{unit}
|
||||
, #{amount}
|
||||
, #{unitPrice}
|
||||
, #{salePrice}
|
||||
<if test='specialNoteCd != null and specialNoteCd != ""'>
|
||||
, #{specialNoteCd}
|
||||
</if>
|
||||
, #{pkgMaterialFlg}
|
||||
, #{itemChangeFlg}
|
||||
, #{fileUploadFlg}
|
||||
, #{partAdd}
|
||||
, #{delFlg}
|
||||
, GETDATE()
|
||||
, #{userId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertEstimateRoof" parameterType="com.interplug.qcast.biz.estimate.dto.RoofRequest">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.insertEstimateRoof */
|
||||
<selectKey keyProperty="roofNo" keyColumn="roofNo" resultType="String" order="AFTER">
|
||||
@ -517,21 +697,21 @@
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateRoofList */
|
||||
DELETE FROM T_ROOF_ESTIMATE
|
||||
WHERE OBJECT_NO = #{objectNo}
|
||||
AND PLAN_NO = #{planNo}
|
||||
AND PLAN_NO = #{planNo}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEstimateRoofItemList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateRoofItemList */
|
||||
DELETE FROM T_ROOF_ITEM_ESTIMATE
|
||||
WHERE OBJECT_NO = #{objectNo}
|
||||
AND PLAN_NO = #{planNo}
|
||||
AND PLAN_NO = #{planNo}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEstimateItemList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateItemList */
|
||||
DELETE FROM T_PART_ESTIMATE
|
||||
WHERE OBJECT_NO = #{objectNo}
|
||||
AND PLAN_NO = #{planNo}
|
||||
AND PLAN_NO = #{planNo}
|
||||
</delete>
|
||||
|
||||
<insert id="insertEstimateCopy" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
SELECT
|
||||
TOP 1
|
||||
U.OBJECT_NO
|
||||
, U.PLAN_NO
|
||||
, U.NO
|
||||
, U.FAILE_NAME
|
||||
, U.CATEGORY
|
||||
|
||||
@ -307,6 +307,7 @@
|
||||
, S.SALE_STORE_LEVEL
|
||||
, ISNULL(P.PREF_NAME, '') AS PREF_NAME
|
||||
, ISNULL(PA.AREA_NAME, '') AS AREA_NAME
|
||||
, (SELECT COUNT(1) FROM T_PLAN WHERE OBJECT_NO = O.OBJECT_NO AND DEL_FLG = '0' AND DRAWING_ESTIMATE_CREATE_DATE IS NOT NULL) AS ESTIMATE_TOT_CNT
|
||||
FROM T_OBJECT O WITH (NOLOCK)
|
||||
INNER JOIN M_SALES_STORE S WITH(NOLOCK)
|
||||
ON O.SALE_STORE_ID = S.SALE_STORE_ID
|
||||
|
||||
Binary file not shown.
BIN
src/main/resources/template/pdf/BIZUDPGothic-Regular.ttf
Normal file
BIN
src/main/resources/template/pdf/BIZUDPGothic-Regular.ttf
Normal file
Binary file not shown.
@ -0,0 +1,255 @@
|
||||
<!doctype html>
|
||||
<html lang="ja">
|
||||
<head>
|
||||
<style>
|
||||
@media print {
|
||||
body {
|
||||
print-color-adjust: exact;
|
||||
-webkit-print-color-adjust: exact;
|
||||
}
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
font-family: M-Gothic;
|
||||
font-size: 11px;
|
||||
border-collapse: collapse;
|
||||
margin: 0 auto;
|
||||
line-height: 150%;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 5px 5px 3px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
border: 1px solid #000;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #eee;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
td {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.col-20 {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.col-15 {
|
||||
width: 15%;
|
||||
}
|
||||
|
||||
body {
|
||||
max-width: 740px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.mb20 {
|
||||
margin-bottom: 20px; /* 아래쪽 간격 */
|
||||
}
|
||||
|
||||
.guide-box {
|
||||
border: 1px solid #000;
|
||||
padding: 15px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.guide-content {
|
||||
line-height: 1.4;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* 차트 설정 */
|
||||
.chart-wrapper {
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
margin: 30px 0;
|
||||
height: 324.3px;
|
||||
}
|
||||
|
||||
.chart-wrapper td {
|
||||
padding: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.chart-wrapper td.y-axis-wrap {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.y-axis {
|
||||
margin-top: -5px;
|
||||
}
|
||||
|
||||
.y-axis td {
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
vertical-align: bottom;
|
||||
padding: 12.3px 0;
|
||||
}
|
||||
|
||||
.y-axis td.zero {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.y-axis td.top {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.chart-wrapper td.bar-cell {
|
||||
position: relative;
|
||||
vertical-align: bottom;
|
||||
border-bottom: 1px solid #ddd;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.chart-wrapper td.bar-cell .bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 13.4px;
|
||||
width: 30px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.chart-wrapper td.month-cell {
|
||||
font-size: 12px;
|
||||
padding-top: 7px;
|
||||
}
|
||||
|
||||
.chart-line {
|
||||
}
|
||||
|
||||
.chart-line td {
|
||||
background-color: transparent;
|
||||
padding: 18.2px 0;
|
||||
border-bottom: 1px solid #ddd !important;
|
||||
}
|
||||
|
||||
.chart-line td.top {
|
||||
padding: 1px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="section1">1111111111</div>
|
||||
<div class="section2">222222222</div>
|
||||
<div class="section3">
|
||||
<table class="mb20">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="col-15">物件番号</th>
|
||||
<td id="objectNo"></td>
|
||||
<th class="col-15">作成日</th>
|
||||
<td id="drawingEstimateCreateDate"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="col-15">都道府県</th>
|
||||
<td id="prefName"></td>
|
||||
<th class="col-15">日射量観測地点</th>
|
||||
<td id="areaName"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="col-15">システム容量</th>
|
||||
<td id="capacity"></td>
|
||||
<th class="col-15">年間予測発電量</th>
|
||||
<td id="anlFrcsGnrt"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="col-15">積雪条件</th>
|
||||
<td id="snowfall"></td>
|
||||
<th class="col-15">風速条件</th>
|
||||
<td id="standardWindSpeedId"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="pwrGnrChartImg">
|
||||
<table class="chart-wrapper">
|
||||
<tbody>
|
||||
<tr id="htmlX">
|
||||
<td class="y-axis-wrap">
|
||||
<table class="y-axis">
|
||||
<tbody id="htmlY">
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="month-cell"></td>
|
||||
<td class="month-cell">1月</td>
|
||||
<td class="month-cell">2月</td>
|
||||
<td class="month-cell">3月</td>
|
||||
<td class="month-cell">4月</td>
|
||||
<td class="month-cell">5月</td>
|
||||
<td class="month-cell">6月</td>
|
||||
<td class="month-cell">7月</td>
|
||||
<td class="month-cell">8月</td>
|
||||
<td class="month-cell">9月</td>
|
||||
<td class="month-cell">10月</td>
|
||||
<td class="month-cell">11月</td>
|
||||
<td class="month-cell">12月</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
● 予測発電量[kWh]
|
||||
</div>
|
||||
<table class="mb20">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>1月</th>
|
||||
<th>2月</th>
|
||||
<th>3月</th>
|
||||
<th>4月</th>
|
||||
<th>5月</th>
|
||||
<th>6月</th>
|
||||
<th>7月</th>
|
||||
<th>8月</th>
|
||||
<th>9月</th>
|
||||
<th>10月</th>
|
||||
<th>11月</th>
|
||||
<th>12月</th>
|
||||
<th>合計</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr id="frcPwrGnrList_detail">
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="mb20">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-15">屋根面</th>
|
||||
<th class="col-15">傾斜角</th>
|
||||
<th class="col-15">方位角(度)</th>
|
||||
<th>太陽電池モジュール</th>
|
||||
<th class="col-15">枚数</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="roofModuleList_detail">
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="mb20">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>パワーコンディショナー</th>
|
||||
<th class="col-20">台</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="pcsList_detail">
|
||||
</tbody>
|
||||
</table>
|
||||
<div>
|
||||
● Hanwha Japan 年間発電量シミュレーション案内事項
|
||||
</div>
|
||||
<div class="guide-box">
|
||||
<div class="guide-content" id="guideInfo"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user