견적서 다운로드 도면 이미지 추가 개발
This commit is contained in:
parent
75775508db
commit
577107f9a2
@ -34,10 +34,7 @@ import com.interplug.qcast.util.InterfaceQsp;
|
|||||||
import com.interplug.qcast.util.PdfUtil;
|
import com.interplug.qcast.util.PdfUtil;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.*;
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -49,6 +46,7 @@ import org.apache.poi.ss.usermodel.Workbook;
|
|||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
|
import org.jxls.util.Util;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
@ -66,12 +64,12 @@ public class EstimateService {
|
|||||||
@Value("${file.ini.root.path}")
|
@Value("${file.ini.root.path}")
|
||||||
private String baseDirPath;
|
private String baseDirPath;
|
||||||
|
|
||||||
|
@Value("${file.ini.drawing.img.path}")
|
||||||
|
private String drawingDirPath;
|
||||||
|
|
||||||
@Value("${qsp.url}")
|
@Value("${qsp.url}")
|
||||||
private String QSP_API_URL;
|
private String QSP_API_URL;
|
||||||
|
|
||||||
@Value("${file.excel.template.path}")
|
|
||||||
private String excelTemplateFilePath;
|
|
||||||
|
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
private final EstimateMapper estimateMapper;
|
private final EstimateMapper estimateMapper;
|
||||||
@ -719,7 +717,6 @@ public class EstimateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR);
|
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1235,6 +1232,18 @@ public class EstimateService {
|
|||||||
EstimateResponse estimateResponse = new EstimateResponse();
|
EstimateResponse estimateResponse = new EstimateResponse();
|
||||||
String splitStr = "、";
|
String splitStr = "、";
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
if (StringUtils.isEmpty(estimateRequest.getObjectNo())) {
|
||||||
|
throw new QcastException(
|
||||||
|
ErrorCode.INVALID_INPUT_VALUE,
|
||||||
|
message.getMessage("common.message.required.data", "Object No"));
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(estimateRequest.getPlanNo())) {
|
||||||
|
throw new QcastException(
|
||||||
|
ErrorCode.INVALID_INPUT_VALUE,
|
||||||
|
message.getMessage("common.message.required.data", "Plan No"));
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 견적서 상세 조회
|
// 견적서 상세 조회
|
||||||
estimateResponse = estimateMapper.selectEstimatePdfDetail(estimateRequest);
|
estimateResponse = estimateMapper.selectEstimatePdfDetail(estimateRequest);
|
||||||
@ -1400,6 +1409,24 @@ public class EstimateService {
|
|||||||
|
|
||||||
estimateResponse.setPwrGnrSim(pwrGnrSimResponse);
|
estimateResponse.setPwrGnrSim(pwrGnrSimResponse);
|
||||||
|
|
||||||
|
// 도면 이미지 셋팅
|
||||||
|
String baseDrawingImgName = estimateRequest.getObjectNo() + "_" + estimateRequest.getPlanNo();
|
||||||
|
File file = new File(drawingDirPath + File.separator + baseDrawingImgName + "_1.png");
|
||||||
|
if (file.exists()) {
|
||||||
|
InputStream imageInputStream =
|
||||||
|
new FileInputStream(drawingDirPath + File.separator + baseDrawingImgName + "_1.png");
|
||||||
|
byte[] drawingImg1 = Util.toByteArray(imageInputStream);
|
||||||
|
estimateResponse.setDrawingImg1(drawingImg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
file = new File(drawingDirPath + File.separator + baseDrawingImgName + "_2.png");
|
||||||
|
if (file.exists()) {
|
||||||
|
InputStream imageInputStream2 =
|
||||||
|
new FileInputStream(drawingDirPath + File.separator + baseDrawingImgName + "_2.png");
|
||||||
|
byte[] drawingImg2 = Util.toByteArray(imageInputStream2);
|
||||||
|
estimateResponse.setDrawingImg2(drawingImg2);
|
||||||
|
}
|
||||||
|
|
||||||
if ("PDF".equals(estimateRequest.getSchDownload())) { // PDF 다운로드
|
if ("PDF".equals(estimateRequest.getSchDownload())) { // PDF 다운로드
|
||||||
String[] arrSection = new String[6];
|
String[] arrSection = new String[6];
|
||||||
int iSection = 0;
|
int iSection = 0;
|
||||||
@ -1497,6 +1524,7 @@ public class EstimateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR);
|
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1880,7 +1908,12 @@ public class EstimateService {
|
|||||||
elm = doc.getElementById("standardWindSpeedName4");
|
elm = doc.getElementById("standardWindSpeedName4");
|
||||||
elm.text(StringUtils.defaultString(data.getStandardWindSpeedName()));
|
elm.text(StringUtils.defaultString(data.getStandardWindSpeedName()));
|
||||||
|
|
||||||
// 도면(가대제외 이미지) 노출 ???
|
// 도면(가대제외 이미지)
|
||||||
|
if (data.getDrawingImg1() != null) {
|
||||||
|
elm = doc.getElementById("drawingImg1");
|
||||||
|
String imgSrc1 = Base64.getEncoder().encodeToString(data.getDrawingImg1());
|
||||||
|
elm.html("<img src='data:image/png;base64," + imgSrc1 + "' width='660'/>");
|
||||||
|
}
|
||||||
|
|
||||||
int no = 1;
|
int no = 1;
|
||||||
sb = new StringBuilder();
|
sb = new StringBuilder();
|
||||||
@ -2001,7 +2034,12 @@ public class EstimateService {
|
|||||||
elm = doc.getElementById("standardWindSpeedName5");
|
elm = doc.getElementById("standardWindSpeedName5");
|
||||||
elm.text(StringUtils.defaultString(data.getStandardWindSpeedName()));
|
elm.text(StringUtils.defaultString(data.getStandardWindSpeedName()));
|
||||||
|
|
||||||
// 도면(가대 이미지) 노출 ???
|
// 도면(가대 이미지)
|
||||||
|
if (data.getDrawingImg2() != null) {
|
||||||
|
elm = doc.getElementById("drawingImg2");
|
||||||
|
String imgSrc2 = Base64.getEncoder().encodeToString(data.getDrawingImg2());
|
||||||
|
elm.html("<img src='data:image/png;base64," + imgSrc2 + "' width='660'/>");
|
||||||
|
}
|
||||||
|
|
||||||
no = 1;
|
no = 1;
|
||||||
sb = new StringBuilder();
|
sb = new StringBuilder();
|
||||||
|
|||||||
@ -220,6 +220,12 @@ public class EstimateResponse {
|
|||||||
@Schema(description = "염해지역 아이템사용 여부")
|
@Schema(description = "염해지역 아이템사용 여부")
|
||||||
private String saltAreaFlg;
|
private String saltAreaFlg;
|
||||||
|
|
||||||
|
@Schema(description = "도면이미지1")
|
||||||
|
private byte[] drawingImg1;
|
||||||
|
|
||||||
|
@Schema(description = "도면이미지2")
|
||||||
|
private byte[] drawingImg2;
|
||||||
|
|
||||||
// 판매점 정보
|
// 판매점 정보
|
||||||
@Schema(description = "고객 판매점명")
|
@Schema(description = "고객 판매점명")
|
||||||
private String custSaleStoreName;
|
private String custSaleStoreName;
|
||||||
|
|||||||
@ -58,4 +58,4 @@ file:
|
|||||||
root.path: C:\\
|
root.path: C:\\
|
||||||
ini.root.path: C:\\NewEstimate
|
ini.root.path: C:\\NewEstimate
|
||||||
ini.base.filename: 料金シミュレーション.ini
|
ini.base.filename: 料金シミュレーション.ini
|
||||||
excel.template.path: C:\\qcastjp\template
|
ini.drawing.img.path: C:\\NewEstimate\Drawing
|
||||||
@ -58,4 +58,4 @@ file:
|
|||||||
root.path: C:\\
|
root.path: C:\\
|
||||||
ini.root.path: C:\\NewEstimate
|
ini.root.path: C:\\NewEstimate
|
||||||
ini.base.filename: 料金シミュレーション.ini
|
ini.base.filename: 料金シミュレーション.ini
|
||||||
excel.template.path: C:\\qcastjp\\template
|
ini.drawing.img.path: C:\\NewEstimate\Drawing
|
||||||
@ -58,4 +58,4 @@ file:
|
|||||||
root.path: C:\\
|
root.path: C:\\
|
||||||
ini.root.path: \\10.31.0.21\NewEstimate
|
ini.root.path: \\10.31.0.21\NewEstimate
|
||||||
ini.base.filename: 料金シミュレーション.ini
|
ini.base.filename: 料金シミュレーション.ini
|
||||||
excel.template.path: C:\\qcastjp\\template
|
ini.drawing.img.path: \\10.31.0.21\NewEstimate\Drawing
|
||||||
@ -238,7 +238,7 @@
|
|||||||
AND O.SALE_STORE_ID = #{schOtherSelSaleStoreId}
|
AND O.SALE_STORE_ID = #{schOtherSelSaleStoreId}
|
||||||
</if>
|
</if>
|
||||||
<if test='schAddress != null and schAddress != ""'>
|
<if test='schAddress != null and schAddress != ""'>
|
||||||
AND O.ADDRESS LIKE '%' + #{schAddress} + '%'
|
AND CONCAT(P.PREF_NAME, ' ', O.ADDRESS) LIKE '%' + #{schAddress} + '%'
|
||||||
</if>
|
</if>
|
||||||
<if test='schObjectName != null and schObjectName != ""'>
|
<if test='schObjectName != null and schObjectName != ""'>
|
||||||
AND O.OBJECT_NAME LIKE '%' + #{schObjectName} + '%'
|
AND O.OBJECT_NAME LIKE '%' + #{schObjectName} + '%'
|
||||||
|
|||||||
Binary file not shown.
@ -661,8 +661,7 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="guide-box">
|
<div class="guide-box">
|
||||||
<div class="guide-content">
|
<div class="guide-content" id="drawingImg1">
|
||||||
<!-- <img src="C:\Users\dlsgk\OneDrive\바탕 화면\펭귄부부.jpg" style="width: 100%;height: auto;display: block;"/> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -773,8 +772,7 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="guide-box">
|
<div class="guide-box">
|
||||||
<div class="guide-content">
|
<div class="guide-content" id="drawingImg2">
|
||||||
<!-- <img src="C:\Users\dlsgk\OneDrive\바탕 화면\펭귄부부.jpg" style="width: 100%;height: auto;display: block;"/> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user