puzhibing
2024-02-18 c1a537aaa86fbb878cea6ab29a2df41ae15a4c48
修改bug
2个文件已修改
38 ■■■■ 已修改文件
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/itextpdf/HtmlToPdfUtils.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -209,9 +209,6 @@
            Map<String, Object> data = price.getData();
            Double ordinary = Double.valueOf(data.get("ordinary").toString());
            Double precious = Double.valueOf(data.get("precious").toString());
            Double discount = Double.valueOf(data.get("discount").toString());
            Double discountMoney = Double.valueOf(data.get("discountMoney").toString());
            Integer activityId = Integer.valueOf(data.get("activityId").toString());
            data.put("ordinary", ordinary * number);
            data.put("precious", precious * number);
        }
@@ -219,9 +216,7 @@
            Map<String, Object> data = price.getData();
            Double ordinary = Double.valueOf(data.get("ordinary").toString());
            Double precious = Double.valueOf(data.get("precious").toString());
            Double discount = Double.valueOf(data.get("discount").toString());
            Double discountMoney = Double.valueOf(data.get("discountMoney").toString());
            Integer activityId = Integer.valueOf(data.get("activityId").toString());
            data.put("ordinary", ordinary - discountMoney);
            data.put("precious", precious - discountMoney);
        }
@@ -302,9 +297,15 @@
        Map<String, Object> data = price.getData();
        Double ordinary = Double.valueOf(data.get("ordinary").toString());
        Double precious = Double.valueOf(data.get("precious").toString());
        Double discount = Double.valueOf(data.get("discount").toString());
        Double discount = null;
        if(null != data.get("discount")){
            discount = Double.valueOf(data.get("discount").toString());
        }
        Double discountMoney = Double.valueOf(data.get("discountMoney").toString());
        Integer activityId = Integer.valueOf(data.get("activityId").toString());
        Integer activityId = null;
        if(null != data.get("activityId")){
            activityId = Integer.valueOf(data.get("activityId").toString());
        }
        orderLogistics.setOrderMoney((cargoType == 1 ? ordinary : precious) + tipMoney);
        orderLogistics.setTravelMoney((cargoType == 1 ? ordinary : precious));
        if(type == 5){
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/itextpdf/HtmlToPdfUtils.java
@@ -9,6 +9,7 @@
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.font.FontProvider;
import org.apache.commons.lang.StringUtils;
import java.io.FileInputStream;
import java.io.IOException;
@@ -66,21 +67,21 @@
        //添加页码
        //pdfDocument.addEventHandler(PdfDocumentEvent.END_PAGE,new PageEventHandler());
//        //添加中文字体支持
//        ConverterProperties properties = new ConverterProperties();
//        FontProvider fontProvider = new FontProvider();
//
//        PdfFont sysFont = PdfFontFactory.createFont("STSongStd-Light", "UniGB-UCS2-H", false);
//        fontProvider.addFont(sysFont.getFontProgram(), "UniGB-UCS2-H");
//
//        //添加自定义字体,例如微软雅黑
        //添加中文字体支持
        ConverterProperties properties = new ConverterProperties();
        FontProvider fontProvider = new FontProvider();
        PdfFont sysFont = PdfFontFactory.createFont("STSongStd-Light", "UniGB-UCS2-H", false);
        fontProvider.addFont(sysFont.getFontProgram(), "UniGB-UCS2-H");
        //添加自定义字体,例如微软雅黑
//        if (StringUtils.isNotBlank(fontPath)){
//            PdfFont microsoft = PdfFontFactory.createFont(fontPath, PdfEncodings.IDENTITY_H, false);
//            fontProvider.addFont(microsoft.getFontProgram(), PdfEncodings.IDENTITY_H);
//        }
//
//        properties.setFontProvider(fontProvider);
        HtmlConverter.convertToPdf(htmlStream, pdfDocument);
        properties.setFontProvider(fontProvider);
        HtmlConverter.convertToPdf(htmlStream, pdfDocument, properties);
        pdfWriter.close();
        pdfDocument.close();