|
@@ -1,5 +1,6 @@
|
|
|
package com.jd.printserver.javafx.entity;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.jd.printserver.common.constants.Constants;
|
|
|
import lombok.Data;
|
|
|
|
|
@@ -10,13 +11,13 @@ public class PrintParam {
|
|
|
* (print)
|
|
|
* 作业名称
|
|
|
*/
|
|
|
- private String jobName = "EI Auto Print Job 1111111";
|
|
|
+ private String jobName = "EI Auto Print Job";
|
|
|
|
|
|
/**
|
|
|
* (print)
|
|
|
* 打印方向 0 自动(停用) 1 横向 2 纵向
|
|
|
*/
|
|
|
- private Integer orientation = 2;
|
|
|
+ private Integer orientation = 1;
|
|
|
|
|
|
/**
|
|
|
* (print)
|
|
@@ -28,7 +29,7 @@ public class PrintParam {
|
|
|
* (jacob)
|
|
|
* 打印页面类型 1 A3 2 A4 ...
|
|
|
*/
|
|
|
- private Integer pageType=1;
|
|
|
+ private Integer pageType=2;
|
|
|
/**
|
|
|
* (print/jacob)
|
|
|
* 打印区域
|
|
@@ -63,7 +64,7 @@ public class PrintParam {
|
|
|
* 缩放比例 0 自适应(停用) x x%
|
|
|
* 打印缩放fitToPages=4时,scale参数有用
|
|
|
*/
|
|
|
- private Float scale = 0f;
|
|
|
+ private Float scale = 100f;
|
|
|
|
|
|
/**
|
|
|
* (print)
|
|
@@ -103,14 +104,14 @@ public class PrintParam {
|
|
|
* (jacob)
|
|
|
* 打印缩放 1 无打印缩放 2 将所有列打印在一页 3 将所有行打印在一页 4 自定义缩放
|
|
|
*/
|
|
|
- private Integer fitToPages = 1;
|
|
|
+ private Integer fitToPages = 2;
|
|
|
|
|
|
/**
|
|
|
* 毫米转像素
|
|
|
* px = mm * 72 / 25.4
|
|
|
* @return int
|
|
|
*/
|
|
|
- public int mm2px(int value){
|
|
|
+ public int mm2px(double value){
|
|
|
return (int)(value * Constants.PRINT_PX / Constants.MM2INCH);
|
|
|
}
|
|
|
|
|
@@ -118,4 +119,87 @@ public class PrintParam {
|
|
|
System.err.println(new PrintParam());
|
|
|
}
|
|
|
|
|
|
+ public void setNullToDefault(){
|
|
|
+ PrintParam defaultPrintParam = new PrintParam();
|
|
|
+ if(StrUtil.isEmpty(this.jobName)){
|
|
|
+ this.jobName = defaultPrintParam.getJobName();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.orientation == null || (this.orientation < 1)){
|
|
|
+ this.orientation = defaultPrintParam.getOrientation();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.copies == null || copies < 1){
|
|
|
+ this.copies = defaultPrintParam.getCopies();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.pageType == null || pageType < 1){
|
|
|
+ this.pageType = defaultPrintParam.getPageType();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.width == null || width < 1){
|
|
|
+ this.width = defaultPrintParam.getWidth();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.height == null || height < 1){
|
|
|
+ this.height = defaultPrintParam.getHeight();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.marginLeft == null || marginLeft < 1){
|
|
|
+ this.marginLeft = defaultPrintParam.getMarginLeft();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.marginTop == null || marginTop < 1){
|
|
|
+ this.marginTop = defaultPrintParam.getMarginTop();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.marginRight == null || marginRight < 1){
|
|
|
+ this.marginRight = defaultPrintParam.getMarginRight();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.marginBottom == null || marginBottom < 1){
|
|
|
+ this.marginBottom = defaultPrintParam.getMarginBottom();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.unit == null || unit < 1){
|
|
|
+ this.unit = defaultPrintParam.getUnit();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.sides == null || sides < 1){
|
|
|
+ this.sides = defaultPrintParam.getSides();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.chromaticity == null || chromaticity < 1){
|
|
|
+ this.chromaticity = defaultPrintParam.getChromaticity();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.pageRange == null || pageRange < 1){
|
|
|
+ this.pageRange = defaultPrintParam.getPageRange();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(pageRange == 2 && (this.pageRangeStart == null || pageRangeStart < 1)){
|
|
|
+ this.pageRangeStart = defaultPrintParam.getPageRangeStart();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(pageRange == 2 && (this.pageRangeEnd == null || pageRangeEnd < 1)){
|
|
|
+ this.pageRangeEnd = defaultPrintParam.getPageRangeEnd();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.printArea == null || printArea < 1){
|
|
|
+ this.printArea = defaultPrintParam.getPrintArea();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(printArea == 2 && StrUtil.isEmpty(printAreaValue)){
|
|
|
+ this.printAreaValue = defaultPrintParam.getPrintAreaValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.fitToPages == null || fitToPages < 1){
|
|
|
+ this.fitToPages = defaultPrintParam.getFitToPages();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(fitToPages == 4 && (this.scale == null || scale < 1)){
|
|
|
+ this.scale = defaultPrintParam.getScale();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|