HTML转PDF模板

news2024/11/25 14:30:58

一、准备pom依赖

       <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>html2pdf</artifactId>
            <version>1.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <version>2.3.28</version>
        </dependency>

二、准备sparePartsProcurePoCatalogTemplate.html     

相对路径:templates\attrchs\sparePartsProcurePoCatalogTemplate.html

<!DOCTYPE html>
<html>
<meta charset='utf-8'>
<style type='text/css'>
    body {
        margin: 0;
    }
    .pdfdom {
        /* width: 900px; */
        background: #fff;
        box-sizing: border-box;
    }

    .clearfix {
        clear: both;
        height: 0;
        overflow: hidden;
        align: center
    }

    .pdfdom .a4-container {
        background: #fff;
        border: 1px solid #ddd;
        box-sizing: border-box;
        position: relative;
    }

    .pdfdom .a4-container .delivery-title {
        border-bottom: 2px solid #ddd;
        box-sizing: border-box;
    }
    .pdfdom .a4-container .delivery-title img {
        width: 100px;
        box-sizing: border-box;
        padding-left: 10px;
    }
    .pdfdom .a4-container .delivery-title .title {
        margin: 0;
        height: 88px;
        line-height: 88px;
        margin-left: 30px;
    }
    .pdfdom .a4-container .delivery-title .delivery-company-name {
        float: left;
        font-weight: bold;
        line-height: 10px;
        margin: 15px 0px 0px 25px;
    }

    .pdfdom .a4-container .delivery-title .allocate-code {
        width: 200px;
        line-height: 15px;
        font-size: 12px;
        float: left;
        margin: 28px 0px 0px 8px;
    }

    .pdfdom .a4-container .main-content {
        border-bottom: 1px solid #ddd;
    }

    .pdfdom .a4-container .main-content table tr th,
    .pdfdom .a4-container .main-content table tr td {
        border-right: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
        padding: 10px;
        font-size: 13px;
        font-weight: 700;
        box-sizing: border-box;
    }

    .pdfdom .a4-container .main-content table tr th:last-child,
    .pdfdom .a4-container .main-content table tr td:last-child {
        border-right: 0px solid #ddd;
    }

    .pdfdom .a4-container .test-container {
        border-bottom: 1px solid #ddd;
        display: flex;
    }
    .pdfdom .a4-container .test-container .test-container-table {
        /* width: 100%; */
        height: 300px;
    }
    .pdfdom .a4-container .test-container table tr th,
    .pdfdom .a4-container .test-container table tr td {
        border: 1px solid #ddd;
        padding: 10px 4px;
        font-size: 12px;
        /* width: 16%; */
        box-sizing: border-box;
    }
    #body-bottom table tr td {
        font-size: 14px;
    }
    .pdfdom .a4-container .a4-remarks {
        padding: 14px 10px;
        line-height: 20px;
        font-size: 16px;
        border-bottom: 2px solid #ddd;
        box-sizing: border-box;
    }

    .pdfdom .a4-container .a4-img-container {
        padding: 14px 10px;
        font-size: 20px;
        border-bottom: 2px solid #ddd;
    }

    .pdfdom .a4-container .a4-img-container .img-box {
        float: left;
        width: 20%;
    }

    .pdfdom .a4-container .a4-img-container .img-box .img {
        display: inline-block;
        margin: 0 auto;
        width: 125px;
        height: 125px;
    }

    .pdfdom .a4-container .bottom-content {
        box-sizing: border-box;
    }

    .pdfdom .a4-container .bottom-content table tr th,
    .pdfdom .a4-container .bottom-content table tr td {
        border-right: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
        width: 50%;
        padding: 10px;
        font-size: 16px;
        vertical-align: middle
    }

    .pdfdom .a4-container .bottom-content table tr th:last-child,
    .pdfdom .a4-container .bottom-content table tr td:last-child {
        border-right: 0px solid #ddd;
    }

    .pdfdom .a4-container .bottom-content .img {
        height: 90px;
    }

    .green {
        color: #14A16A;
    }

    .red {
        color: #F14855;
    }

    .pdfdom .a4-container table {
        width: 100%;
        border-collapse: collapse;
    }

    .a4-remarks {
        padding: 14px 10px;
        line-height: 26px;
        font-size: 16px;
        border-bottom: 2px solid #ddd;
    }

    .a4-remarks .tc {
        text-align: center;
    }

    .a4-remarks .indent2 {
        text-indent: 2em;
    }

    .a4-remarks .indent3 {
        text-indent: 3em;
    }

    .a4-remarks .lt {
        margin-top: 15px;
        color: #333333;
    }
</style>

<body>
<div class='pdfdom'>
    <div class='a4-container'>
        <div class='delivery-title'>
            <div style="float:left;">
                <img style="width: 85px; height:85px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAADAFBMVEVHcEwToWoUoWouKyUUoWqMlZGhoaE7g2UzLCsUoWqhoaEyKyoToGmhoaEyKyoyKyoUoWqenp4zLCubm5szLCqhoaEwKyifn58uISEwKiqhoaEzLCugoKASnmkzLCuhoaEyKyowKykzLCozKyovLSahoaEzLCsUoWoToWkvKimfn58ToGihoaGhoaEyKyoyLCmfn58yLCqhoaEyLi0yKyoxKikyKyqdnZ0xKymfn58mOSwsKCihoaGioqKgoKCgoKAwJiWhoaGfn5+goKAzLCuenp6fn58xKykyKyqhoaGhoaGgoKCdnZ2hoaGgoKAtJyUyKyqTk5MOkV6Li4syKymioqKioqIyKyqhoaGdnZ2dnZ2ampoyKyoyKyoTn2mgoKChoaEgiFydnZ2goKCgoKChoaExKyoxKikQnGShoaGenp6YmJgToGkoIyInJiIPll+fn5+hoaEvKCcsJyahoaErJiQTll8RnWU3aT+dnZ0xKykNklyWlpYyKykRnGWSkpKZmZmcnJygoKAvKCcuKCYToGksJiURnmUMiVeEhIQyKyqenp4Ull+Li4uJiYmQkJAuKCcwKihubm4RnWYToWkSn2iYmJienp5vb2+ampoPll4UoWoxKimPj48SnWYQmF+goKAiiFIPk18SnmcweEiKiooLjFFwcHCbm5uampppaWmbm5sxKikyKysalV4Ol18wdUWampqTk5MhiVNycnIZl2B9fX1nZ2cfGxkliVQSnGeZmZmHh4dwcHCOjo6Tk5MmISAzckMSnGgQk154eHiIiIiYmJhdXV2pqakOjl4weUktgE0jHh4WnmZqamoOfFMHTC83YjkueEo4aD0UoWozLCuhoaE0LCsUomuioqI1b0Eal2EUomoVn2gckVofjVcZmWIZk1yjo6Mall4So2wdj1kkilUph1IvfEophE83aD4niFMtf0wxdkY1LSwxeUkzdEQUoGmmpqYYm2QXnWUsgU4VnmYZmmMUoWsToms6ZTurq6sUpW02az8djlk2Ly0k59ptAAAA/HRSTlMAz/Jc5AMkAUHm+KIY1G2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AD+s8EKAD8XKKJjEBKRAAAAAElFTkSuQmCC">
            </div>
            <div class='delivery-company-name'>
                <h3>采购订单</h3>
            </div>
            <div class='clearfix'></div>
        </div>
        <div class='main-content'>
            <table>
                <tr>
                    <td>订单时间:${orderTime!}</td>
                    <td>订单编号:${orderCode!}</td>
                </tr>
                <tr>
                    <td>需方(甲方):${partyAName!}</td>
                    <td>供方(乙方):${partyBName!}</td>
                </tr>
                <tr>
                    <td>授权代表:${demandAgent!}</td>
                    <td>授权代表:${supplierAgent!}</td>
                </tr>
                <tr>
                    <td>地址:${demandAddress!}</td>
                    <td>地址:${supplierAddress!}</td>
                </tr>
                <tr>
                    <td>联系方式:${demandContactsStyle!}</td>
                    <td>联系方式:${supplierContactsStyle!}</td>
                </tr>
                <tr>
                    <td colspan="2">经双方友好协议确认,根据下列条款订立本合同:</td>
                </tr>
                <tr>
                    <td colspan="2">一、内容:(甲方向乙方订购以下货物):</td>
                </tr>
            </table>
        </div>

        <div class='test-container'>
            <table cellspacing="0" class="test-container-table">
                <tr>
                    <th width="50px">序号</th>
                    <th width="100px">零配件SKU名称</th>
                    <th width="100px">零配件SKU编码</th>
                    <th width="100px">适用车型</th>
                    <th width="100px">品牌</th>
                    <th width="100px">零配件型号</th>
                    <th width="80px">单位</th>
                    <th width="80px">数量</th>
                    <th width="100px">含税单价(元)</th>
                    <th width="100px">含税金额(元)</th>
                    <th width="80px">收货人</th>
                    <th width="120px">收货人联系方式</th>
                    <th width="100px">收货地址</th>
                    <th width="100px">预估交期</th>
                </tr>
                <#list a  as detail >
                <tr>
                    <td width="50px">${detail.sequence}</td>
                    <td width="100px">${detail.skuName}</td>
                    <td width="100px">${detail.skuCode}</td>
                    <td width="100px">${detail.brandModelName}</td>
                    <td width="100px">${detail.brandName}</td>
                    <td width="100px">${detail.modelName}</td>
                    <td width="80px">${detail.productUnitName}</td>
                    <td width="80px">${detail.purchaseQuantity}</td>
                    <td width="100px">${detail.unitPriceIncludeTax}</td>
                    <td width="100px">${detail.includeTotalAmount}</td>
                    <td width="80px">${detail.receivedPerson}</td>
                    <td width="120px">${detail.receivedPhone}</td>
                    <td width="100px">${detail.receivedAddress}</td>
                    <td width="100px">${detail.estimateTime}</td>
                </tr>
            </#list>
            <tr>
                <td colspan="2">货款合计(大写):(含税费及运费)</td>
                <td colspan="6">${totalAmountStr!}</td>
                <td colspan="1">小写合计</td>
                <td colspan="5">${totalAmount!}</td>
            </tr>
            <tr>
                <td colspan="2">备注</td>
                <td colspan="12">${data.remark}</td>
            </tr>

            </table>

        </div>
        <div id="body-bottom" class='test-container'>
            <table cellspacing="0" class="test-container-table">
                <tr>
                    <td colspan="2">二、本订单未约定事宜以关联采购合同编号: ${data.contractCode!}为准。</td>
                </tr>
                <tr>
                    <td colspan="2">三、其他约定</td>
                </tr>
                <tr>
                    <td colspan="2">1)收货允差天数:正三负零,即提前三天范围内交货是可以接受的,禁止晚交货。</td>
                </tr>
                <tr>
                    <td colspan="2">2)供方在收到订单后,请确认品名规格、数量、交期并于1个工作日内签回。</td>
                </tr>
                <tr>
                    <td colspan="2">3)本订单未约定的内容以框架合同为准;本订单约定的内容与框架合同不一致的,以本订单为准。</td>
                </tr>
                <tr>
                    <td colspan="2">4)本订单中的物料明细不在关联框架合同和补充协议的《供应商产品价格确认表》中的,关于该物料的相关约束使用本订单关联框架合同所有的条款约定 。</td>
                </tr>
                <tr>
                    <td colspan="2">5)本合同正本一式贰份,甲乙双方各执壹份,经双方盖章生效;甲方通过指定邮箱向乙方下达的订单与原合同具有同等效力。</td>
                </tr>
                <tr>
                    <td align="center">甲方</td>
                    <td align="center">乙方</td>
                </tr>
                <tr>
                    <td>甲 方(盖章): ${partyAName!}</td>
                    <td>乙 方(盖章): ${partyBName!}</td>
                </tr>
                <tr>
                    <td>授权代表(签字):</td>
                    <td>授权代表(签字):</td>
                </tr>
            </table>
        </div>
    </div>
</div>
</body>

</html>

三、准备转换代码

 /**
     * 生成 PDF 文件
     *
     * @param procurePoDTO
     */
    public void generatePdfFile(SparePartsProcurePoDTO procurePoDTO,SSOUser ssoUser) {
        this.generatePoCatalogPdfToOss(procurePoDTO,ssoUser);
    }
    /**
     * @Description 生成pdf到阿里云
     * @Param procurePoDTO
     * @Return void
     * @Date 2023/10/20 10:24
     * @Author lwp
     */
    public String generatePoCatalogPdfToOss(SparePartsProcurePoDTO procurePoDTO,SSOUser ssoUser) {
            SparePartsProcurePo sparePartsProcurePo = procurePoDTO.getSparePartsProcurePo();
            String orderCode = sparePartsProcurePo.getOrderCode();
            String htmlStr = this.getHtmlFromPoCatalog(procurePoDTO);
            String url = "";
            //渲染pdf
            File file = null;
            String name = AliOSSUtil.generateUUIDName(".pdf");
            try {
                File fileDir = new File(System.getProperty("user.dir") + "/pdf/");
                if (!fileDir.exists()) {
                    fileDir.mkdirs();
                }
                file = new File(fileDir.getPath() + "/" + name);
                file.createNewFile();
                log.info("采购订单:{} 创建临时文件 {} 是否创建成功:{}", orderCode, file.getPath(), file.exists());
            } catch (IOException e) {
                log.error("采购订单:{} PDF生成失败", orderCode, e);
            }
            try (FileOutputStream fos = new FileOutputStream(file)) {
                PdfSupport.convertStringToPdf(htmlStr, fos);
                log.info("采购订单:{} 上传文件 {} 到阿里云OSS,文件大小 {} byte", orderCode, file.getName(), file.length());
                url = aliossClient.uploadFile(file, "/procurePo/basic/pdf/"+name);
                log.info("采购订单:{} PDFURL:{} 上传到阿里云OSS成功", orderCode, url);
                if (Objects.nonNull(ssoUser)) {
                    uploadExcel(AliOSSHelper.getAccessUrl(url), "易维&四川泰瑞达新能源汽车有限公司-采购订单", ssoUser);
                }
                log.info("采购订单:{} PDFURL:{} 数据库更新成功", orderCode, url);
            } catch (IOException e) {
                log.error("采购订单:{} PDF生成失败", orderCode, e);
            } finally {
                if (file.exists()) {
                    file.delete();
                }
            }
        return  url;
    }

    /**
     * @Description 解析生成html格式
     * @Param procurePoDTO
     * @Return java.lang.String
     * @Date 2023/10/20 10:25
     * @Author lwp
     */
    public String getHtmlFromPoCatalog(SparePartsProcurePoDTO procurePoDTO) {
        SpareParsProcurePoCatalogTemplateData data = buildData(procurePoDTO);
        Map<String, Object> params = new HashMap<>();
        params.put("orderTime",data.getOrderTime());// 订单时间
        params.put("orderCode", data.getOrderCode());// 订单编号
        params.put("partyAName", data.getPartyAName());// 需方(甲方)
        params.put("partyBName", data.getPartyBName());// 供方(乙方)
        params.put("demandAgent", data.getDemandAgent());// 甲方授权代表
        params.put("supplierAgent", data.getSupplierAgent());// 乙方授权代表
        params.put("demandAddress", data.getDemandAddress());// 甲方地址
        params.put("supplierAddress", data.getSupplierAddress());// 乙方地址
        params.put("demandContactsStyle", data.getDemandContactsStyle());// 甲方联系方式
        params.put("supplierContactsStyle", data.getSupplierContactsStyle());// 乙方联系方式
        params.put("totalAmountStr", data.getTotalAmountStr());// 货款合计(大写):(含税费及运费)
        params.put("totalPurchaseQuantity", data.getTotalPurchaseQuantity());// 总数量
        params.put("totalAmount", data.getTotalAmount());// 小写合计
        params.put("contractCode", data.getContractCode());// 合同编码
        params.put("paymentMethodName",data.getPaymentMethodName()); //结算方式
        params.put("invoiceTypeName",data.getInvoiceTypeName()); //发票类型
        params.put("a", data.getDetails());// 采购订单明细列表
        return FreemarkerHelper.renderHtml("attrchs/sparePartsProcurePoCatalogTemplate.html", params);
    }

    /**
     * 上传到导出记录
     * @param url
     * @param fileName
     */
    public  void uploadExcel(String url, String fileName, SSOUser ssoUser){
        Date date = new Date();
        ExportRecord exportRecord = new ExportRecord();
        exportRecord.setFileUrl(url);
        exportRecord.setFileName(fileName);
        exportRecord.setModule(10);
        exportRecord.setModuleName("零配件采购订单");
        //处理完成
        exportRecord.setStatus(2);
        exportRecord.setSource(0);
        exportRecord.setFileClassification(1);
        exportRecord.setRequestMethod("GET");
        exportRecord.setServerName("dst-operate-basic-api");
        exportRecord.setFileType(FileTypeConstant.PDF);
        exportRecord.setCreateUserId(ssoUser.getId());
        exportRecord.setCreateUserName(ssoUser.getRealname());
        exportRecord.setCreateTime(date);
        exportRecord.setUpdateUserId(ssoUser.getId());
        exportRecord.setUpdateUserName(ssoUser.getRealname());
        exportRecord.setUpdateTime(date);
        exportRecordService.save(exportRecord);
    }

四、转换工具 FreemarkerHelper 

package com.dst.common.service;

import freemarker.cache.URLTemplateLoader;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import lombok.extern.slf4j.Slf4j;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.StringWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Slf4j
public class FreemarkerHelper {

    private static Configuration config;

    static {
        config = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
        config.setClassicCompatible(true);
        config.setLocalizedLookup(false);
        config.setDateFormat("yyyy-MM-dd");
        config.setDateTimeFormat("yyyy-MM-dd HH:mm:ss");
        config.setDefaultEncoding("UTF-8");
    }

    public static String renderHtml(String tplName, Map<String,Object> dataModel){
        String htmlStr = "";
        try {
            config.setClassLoaderForTemplateLoading(FreemarkerHelper.class.getClassLoader(),"/templates/");
            Template tpl = config.getTemplate(tplName);
            StringWriter stringWriter = new StringWriter();
            BufferedWriter writer = new BufferedWriter(stringWriter);
            tpl.process(dataModel,writer);
            htmlStr = stringWriter.toString();
        } catch (IOException | TemplateException e) {
            log.error("【renderHtml】处理html异常:",e);
        }
        return htmlStr;
    }

    public static String renderHtmlFromUrl(String tplUrl, Map<String,Object> dataModel){
        String htmlStr = "";
        try {
            config.setTemplateLoader(new RemoteTemplateLoader());
            Template tpl = config.getTemplate(tplUrl);
            StringWriter stringWriter = new StringWriter();
            BufferedWriter writer = new BufferedWriter(stringWriter);
            tpl.process(dataModel,writer);
            htmlStr = stringWriter.toString();
        } catch (IOException | TemplateException e) {
            log.error("【renderHtmlFromUrl】处理html异常:",e);
        }
        return htmlStr;
    }

    static class RemoteTemplateLoader extends URLTemplateLoader{

        @Override
        protected URL getURL(String name) {
            URL url = null;
            try {
                url = new URL(name);
            } catch (MalformedURLException e) {
                log.error("【getURL】获取URL异常:",e);
            }

            return url;
        }
    }

    public static void main(String[] args) throws Exception {
        /*URL url = new URL("http://dst2.oss-cn-shenzhen.aliyuncs.com/test_contract_template_af3404a51225458da3ae5a587076f1cf");
        URLConnection connection = url.openConnection();
        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(),"UTF-8"));
        reader.lines().forEach(line -> System.out.println(line));*/
        Map<String,Object> dataModel = new HashMap<>();
        dataModel.put("myDate",new Date());
        String result = renderHtml("test.html",dataModel);
        System.out.println(result);

//        System.out.println(InetAddress.getByName("dst2.oss-cn-shenzhen.aliyuncs.com").getHostAddress());
    }
}

五、HTML转PDF工具类PdfSupport

package com.dst.common.service;

import com.itextpdf.html2pdf.ConverterProperties;
import com.itextpdf.html2pdf.HtmlConverter;
import com.itextpdf.html2pdf.attach.ITagWorkerFactory;
import com.itextpdf.io.font.FontProgram;
import com.itextpdf.io.image.ImageData;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.font.FontProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;

public abstract class PdfSupport {
    private static final Logger LOGGER = LoggerFactory.getLogger(PdfSupport.class);

    public static FontProgram simsun;
    public static FontProgram awesome;
    public static ImageData logo;

    public static FontProvider fontProvider;

    public static FontProvider createFontProvider() {
        if (fontProvider == null){
            fontProvider = new FontProvider();
            fontProvider.addStandardPdfFonts();
            fontProvider.addFont(simsun);
            fontProvider.addFont(awesome);
        }
        return fontProvider;
    }

    protected static ConverterProperties createConverterProperties(){
        ConverterProperties prop = new ConverterProperties();
        prop.setFontProvider(createFontProvider());
//        prop.setBaseUri("/static");
        return prop;
    }

    public static void convertToPdf(String htmlStr, OutputStream pdfStream, ConverterProperties converterProperties) throws IOException {
        HtmlConverter.convertToPdf(htmlStr,pdfStream,converterProperties);
    }


    public static void convertStringToPdf(String htmlStr, OutputStream pdfStream, ITagWorkerFactory tagWorkerFactory) throws IOException {
        ConverterProperties converterProperties = createConverterProperties();
        converterProperties.setTagWorkerFactory(tagWorkerFactory);
        HtmlConverter.convertToPdf(htmlStr,pdfStream,converterProperties);
    }

    public static void convertStringToPdf(String htmlStr, OutputStream pdfStream) throws IOException {
        HtmlConverter.convertToPdf(htmlStr,pdfStream,createConverterProperties());
    }

    public static PdfDocument createPdfDocument(OutputStream outputStream) throws Exception {
        return new PdfDocument(new PdfWriter(outputStream));
    }

    public static Document convertToDocument(String html, PdfDocument pdfDoc, ConverterProperties prop) throws IOException {
        return HtmlConverter.convertToDocument(html,pdfDoc,prop);
    }

    public void outFile(String fileName, String htmlStr,HttpServletResponse response) {
        try {
            String value = "attachment;filename=" + new String((fileName + System.currentTimeMillis() + ".pdf").getBytes("gb2312"), "ISO8859-1");
            response.setHeader("Content-Disposition", value);
            response.setContentType("application/octet-stream;charset=utf-8");
            response.setHeader("Cache-Control", "no-cache");//设置头
            response.setDateHeader("Expires", 0);//设置日期头
            OutputStream out = response.getOutputStream();
            convertToPdf(htmlStr,out);
            out.flush();
        } catch (Exception e) {
            LOGGER.error("OutputStream error", e);
        }
    }

    protected abstract void convertToPdf(String htmlStr, OutputStream out) throws Exception;

}

六、转换实体类

package com.dstcar.entitys.sparepartsprocurepo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SpareParsProcurePoCatalogTemplateData implements Serializable {

    /** 采购订单号 规则:CGDD+日期+流水号,按日期累加 **/
    private String orderCode;

    /** 订单日期 **/
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private String orderTime;

    /** 甲方名称 **/
    private String partyAName;

    /** 乙方名称 **/
    private String partyBName;

    /** 需方授权代表 **/
    private String demandAgent;

    /** 供方授权代表 **/
    private String supplierAgent;

    /** 需方地址 **/
    private String demandAddress;

    /** 供方地址 **/
    private String supplierAddress;

    /** 需方联系方式 **/
    private String demandContactsStyle;

    /** 供方联系方式 **/
    private String supplierContactsStyle;

    /** 结算方式:1月结30天|2月结60天|3月结90天|4先款后货(字典:spare_parts_payment_method) **/
    private String paymentMethodName;

    /** 发票类型:1增值税发票2普通发票(字典:spare_parts_po_invoice_type) **/
    private String invoiceTypeName;

    /** 订单总额(产品明细含税总额合计【含税总额(含税单价unitPriceIncludeTax * 采购数量purchaseQuantity)】) **/
    private BigDecimal totalAmount;

    /**
     * 订单总额大写文字
     */
    private String totalAmountStr;

    /**
     * 总的采购数量
     */
    private BigDecimal totalPurchaseQuantity;

    /** 备注 **/
    private String remark;

    /** 关联合同号 **/
    private String contractCode;

    /** po订单明细 */
    private List<SpareParsProcurePoCatalogSkuTemplateData> details;

}


package com.dstcar.entitys.sparepartsprocurepo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;


@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SpareParsProcurePoCatalogSkuTemplateData implements Serializable {

    /**
     * 序号
     */
    private Integer sequence;

    /** 零配件sku名称 **/
    private String skuName;

    /** 零部件SKU编码 **/
    private String skuCode;

    /**
     * 适用车型名称
     * 备注:适用车型下拉框选择‘通用’时该字段为空
     *      适用车型下拉框选择‘部分车型适用’时该字段翻译(适用车型里面的品牌+型号拼接而成)
     */
    private String brandModelName;

    /**
     * 零配件品牌名称
     */
    private String brandName;

    /**
     * 零配件型号名称
     */
    private String  modelName;

    /** 计量单位 */
    private String productUnitName;

    /** 采购数量 **/
    private BigDecimal purchaseQuantity;

    /** 含税单价 **/
    private BigDecimal unitPriceIncludeTax;

    /** 含税总额(含税单价*采购数量) **/
    private BigDecimal includeTotalAmount;

    /** 收货人 **/
    private String receivedPerson;

    /** 收货人联系电话 **/
    private String receivedPhone;

    /** 收货人地址 **/
    private String receivedAddress;

    /** 预估交期 **/
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private String estimateTime;


}

 七、最终转换效果

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1208499.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

LockBit3.0的字符串解密方法

LockBit 与大多数勒索黑客团体一样以勒索软件即服务 (RaaS) 模式运行,该组织于 2019 年 9 月首次被观察到,此后发展为了今年最主要的勒索软件团伙,甚至超过了Conti、Hive等其他知名团体。据泄露数据站点的数据统计表明,LockBit占2022年第一季度所有与勒索软件相关的泄露事件…

基于自私羊群算法优化概率神经网络PNN的分类预测 - 附代码

基于自私羊群算法优化概率神经网络PNN的分类预测 - 附代码 文章目录 基于自私羊群算法优化概率神经网络PNN的分类预测 - 附代码1.PNN网络概述2.变压器故障诊街系统相关背景2.1 模型建立 3.基于自私羊群优化的PNN网络5.测试结果6.参考文献7.Matlab代码 摘要&#xff1a;针对PNN神…

基于闪电搜索算法优化概率神经网络PNN的分类预测 - 附代码

基于闪电搜索算法优化概率神经网络PNN的分类预测 - 附代码 文章目录 基于闪电搜索算法优化概率神经网络PNN的分类预测 - 附代码1.PNN网络概述2.变压器故障诊街系统相关背景2.1 模型建立 3.基于闪电搜索优化的PNN网络5.测试结果6.参考文献7.Matlab代码 摘要&#xff1a;针对PNN神…

【开源】基于JAVA的超市商品管理系统

目录 一、摘要1.1 简介1.2 项目详细录屏 二、研究内容2.1 数据中心模块2.2 超市区域模块2.3 超市货架模块2.4 商品类型模块2.5 商品档案模块 三、系统设计3.1 用例图3.2 时序图3.3 类图3.4 E-R图 四、系统实现4.1 登录4.2 注册4.3 主页4.4 超市区域管理4.5 超市货架管理4.6 商品…

使用清华智谱ChatGLM2大模型搭建本地私有知识库

首先放上该方案项目的git地址&#xff1a;https://github.com/chatchat-space/Langchain-Chatchat 以下是我的搭建和踩坑经验记录 一、环境准备 1、python安装 在环境中安装python&#xff0c;我安装的是3.9版本的python&#xff0c;官方要求的是Python 3.8 - 3.10 版本。不知…

蒙特卡洛树搜索(Monte Carlo Tree Search)揭秘

一. 什么是蒙特卡洛树搜索 蒙特卡洛树搜索(MCTS)是一种启发式搜索算法&#xff0c;一般用在棋牌游戏中&#xff0c;如围棋、西洋棋、象棋、黑白棋、德州扑克等。MCTS与人工神经网络结合&#xff0c;可发挥巨大的作用&#xff0c;典型的例子是2016年的AlphaGo&#xff0c;以4:1…

可以通过电脑远程控制安卓设备的软件

有些时候&#xff0c;我们需要用电脑远程控制安卓设备&#xff0c;比如远程维护门店设备、安卓系统的户外广告牌等等。我们来探索和比较几款允许用户通过电脑远程控制安卓设备的软件。 1、Splashtop Business Splashtop 是一种多功能远程访问解决方案&#xff0c;以其高性能流…

hadoop 如何关闭集群 hadoop使用脚本关闭集群 hadoop(八)

1. hadoop22, hadoop23, hadoop24三台机器 2. namenode 所在hadoop22关闭 hdfs: # 找到/etc/hadoop位置 cd /opt/module/hadoop-3.3.4/etc/hadoop # 找到shell脚本&#xff0c;关闭即可sbin/stop-dfs.sh 3. 关闭yarn脚本&#xff0c;我的在hadoop23&#xff1a; # 找到/etc…

数据库期末考前复习题(单选+多选+判断+解答)

文章目录 #数据库考前复习题一、 选择1.单选题2.多选题 二、判断题三、解答请描述数据库中的三大范式关系型数据库ACID特性 #数据库考前复习题 一、 选择 1.单选题 1.使用limit进行分页查询&#xff0c;其中每页10条数据&#xff0c;查询第5页应该写为&#xff1f; SELECT *…

压测工具主要功能是什么?该怎样选择?

压测工具是一类用于模拟并评估系统在不同负载条件下的性能的软件应用程序。通过模拟大量用户同时访问系统&#xff0c;压测工具能够帮助开发者识别系统的瓶颈、性能瓶颈以及潜在的故障点。这种实时、模拟的方式允许开发者在正式投入使用之前发现并解决问题&#xff0c;提高系统…

Java学习之路 —— Day2(OOP)

文章目录 1. 方法2. OOP2.1 static2.2 单例模式2.3 继承2.4 多态 3. 常用API3.1 包3.2 String3.3 ArrayList 1. 方法 方法定义时要使用public static修饰&#xff0c;这是和C最不同的地方&#xff0c;因为java都是基于类执行的。 Java的参数传递机制是值传递&#xff0c;即传…

树莓派Ubuntu20.04设置静态IP后无法联网的问题及解决

一、问题描述 在使用虚拟机进行ssh远程连接时&#xff0c;需要知道目标机Ubuntu系统的用户名和IP地址&#xff0c;若IP地址是动态的&#xff0c;则每次远程连接前都需要接上显示器查看IP信息&#xff0c;很繁琐&#xff0c;所以需要设置静态的IP。 二、设置步骤 首先&#x…

HackTheBox-Starting Point--Tier 2---Vaccine

文章目录 一 Vaccine 测试过程1.1 打点1.1.1 FTP匿名登录1.1.2 SQL注入 1.2 权限提升 二 题目 一 Vaccine 测试过程 1.1 打点 1.端口扫描 nmap -sV -sC 10.129.191.631.1.1 FTP匿名登录 2.FTP允许匿名登录&#xff0c;发现backup.zip ftp 10.129.191.63解压backup.zip&#x…

王道计网:网络层

转发是路由器内部 路由选择是路由器之间 一、概述和功能

Vue基础必备掌握知识点-Vue的指令系统讲解(二)

Vue指令系统继续讲解 v-for 作用:基于数据进行循环&#xff0c;多次渲染整个元素 数据类型:数组.对象.数字。。。 遍历数组语法&#xff1a;v-for"(item,index)" in 数组 item:表示每一项 index:则是表现下标 注意:v-for中的key值&#xff0c;key属性唯一的…

《从零开始读懂相对论》

内容简介 相对论诞生至今已逾百年&#xff0c;但依然被人们津津乐道。相对论为什么如此有魅力&#xff1f;爱因斯坦为什么要创立相对论&#xff1f;本书从“零”开始&#xff0c;紧抓“相对”二字&#xff0c;将所有问题置于历史的背景下&#xff0c;竭力展现人类探索运动本质…

腾讯云2核4G服务器CVM标准型S5实例租用5年价格表

腾讯云服务器网整理五年云服务器活动 txyfwq.com/go/txy 配置可选2核4G和4核8G&#xff0c;公网带宽可选1M、3M或5M&#xff0c;系统盘为50G高性能云硬盘&#xff0c;标准型S5实例CPU采用主频2.5GHz的Intel Xeon Cascade Lake或者Intel Xeon Cooper Lake处理器&#xff0c;睿频…

软考架构师学习心得和资料分享

23年11月的软考架构师终于考完了&#xff0c;相信很多朋友都觉得这次考试的内容有点难&#xff0c;我是从9月份报名后才开始准备的&#xff0c;一边工作一边学习确实压力很大&#xff0c;感觉更难了。 报名后还在闲鱼上买了份学习资料&#xff0c;后来又在芝士架构群里找了一些…

一文搞定接口自动化测试框架搭建orPytest_知识点总结

pytest编写的规则&#xff1a; 1、测试文件以test_开头&#xff08;以_test结尾也可以&#xff09; 2、测试类以Test开头&#xff0c;并且不能带有__init__方法 3、测试函数以test_开头 4、断言必须使用assert pytest.main([-s,-v]) &#xff1a;用来执行测试用例 -s 打印prin…

使用matlab制作声音采样率转换、播放以及显示的界面

利用matlab做一个声音采样率转换、播放以及显示的界面 大抵流程&#xff1a; 图形界面创建&#xff1a;使用figure函数创建名为“声音采样率转换”的图形界面&#xff0c;并设置了其位置和大小。 按钮和文本框&#xff1a;使用uicontrol函数创建了选择音频文件的按钮、显示当前…