Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
07900627
Commit
07900627
authored
Jun 17, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
压缩视频
parent
06c2d40c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
19 deletions
+72
-19
PrinterPagerData.java
...ava/com/yanzuoguang/util/printer/vo/PrinterPagerData.java
+15
-19
TestPrinterHelper.java
yzg-util-print/src/test/java/helper/TestPrinterHelper.java
+56
-0
from.json
yzg-util-print/src/test/java/helper/from.json
+1
-0
No files found.
yzg-util-print/src/main/java/com/yanzuoguang/util/printer/vo/PrinterPagerData.java
View file @
07900627
...
@@ -18,50 +18,46 @@ public class PrinterPagerData extends BaseVo {
...
@@ -18,50 +18,46 @@ public class PrinterPagerData extends BaseVo {
@JSONField
(
name
=
"PageWidth"
)
@JSONField
(
name
=
"PageWidth"
)
private
double
pageWidth
;
private
double
pageWidth
;
/**
/**
* 纸张高度
* 纸张高度
*/
*/
@JSONField
(
name
=
"Page
Width
"
)
@JSONField
(
name
=
"Page
Height
"
)
private
double
pageHeight
;
private
double
pageHeight
;
/**
/**
* 左边边距
* 左边边距
*/
*/
@JSONField
(
name
=
"
PageWidth
"
)
@JSONField
(
name
=
"
MarginLeft
"
)
private
double
marginLeft
;
private
double
marginLeft
;
/**
/**
* 上边边距
* 上边边距
*/
*/
@JSONField
(
name
=
"
PageWidth
"
)
@JSONField
(
name
=
"
MarginTop
"
)
private
double
marginTop
;
private
double
marginTop
;
/**
///
右边边距
*
右边边距
*/
@JSONField
(
name
=
"
PageWidth
"
)
@JSONField
(
name
=
"
MarginRight
"
)
private
double
marginRight
;
private
double
marginRight
;
/**
///
下边边距
*
下边边距
*/
@JSONField
(
name
=
"
PageWidth
"
)
@JSONField
(
name
=
"
MarginBottom
"
)
private
double
marginBottom
;
private
double
marginBottom
;
/**
/**
* 打印角度
* 打印角度
*/
*/
@JSONField
(
name
=
"P
ageWidth
"
)
@JSONField
(
name
=
"P
rintAngle
"
)
private
float
printAngle
;
private
float
printAngle
;
/**
/**
* 所有页面需要打印得属性
* 所有页面需要打印得属性
*/
*/
@JSONField
(
name
=
"
PageWidth
"
)
@JSONField
(
name
=
"
Items
"
)
private
List
<
PrinterPagerItemData
>
items
;
private
List
<
PrinterPagerItemData
>
items
;
/**
/**
...
@@ -81,7 +77,7 @@ public class PrinterPagerData extends BaseVo {
...
@@ -81,7 +77,7 @@ public class PrinterPagerData extends BaseVo {
/**
/**
* 清除位置
* 清除位置
*/
*/
p
rivate
void
C
learPosition
()
{
p
ublic
void
c
learPosition
()
{
this
.
items
.
clear
();
this
.
items
.
clear
();
}
}
...
@@ -90,7 +86,7 @@ public class PrinterPagerData extends BaseVo {
...
@@ -90,7 +86,7 @@ public class PrinterPagerData extends BaseVo {
*
*
* @param to 复制到得对象
* @param to 复制到得对象
*/
*/
public
void
C
opyTo
(
PrinterPagerData
to
)
{
public
void
c
opyTo
(
PrinterPagerData
to
)
{
to
.
pageWidth
=
this
.
pageWidth
;
to
.
pageWidth
=
this
.
pageWidth
;
to
.
pageHeight
=
this
.
pageHeight
;
to
.
pageHeight
=
this
.
pageHeight
;
to
.
marginLeft
=
this
.
marginLeft
;
to
.
marginLeft
=
this
.
marginLeft
;
...
...
yzg-util-print/src/test/java/helper/Test
Media
Helper.java
→
yzg-util-print/src/test/java/helper/Test
Printer
Helper.java
View file @
07900627
package
helper
;
package
helper
;
import
com.yanzuoguang.util.PrinterHelper
;
import
com.yanzuoguang.util.PrinterHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.printer.vo.PrinterPagerData
;
import
org.junit.Test
;
import
org.junit.Test
;
import
java.io.File
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
public
class
Test
Media
Helper
{
public
class
Test
Printer
Helper
{
@Test
@Test
public
void
testConvert
()
{
public
void
testConvert
()
{
...
@@ -26,4 +29,28 @@ public class TestMediaHelper {
...
@@ -26,4 +29,28 @@ public class TestMediaHelper {
System
.
out
.
println
(
"result:"
+
result
);
System
.
out
.
println
(
"result:"
+
result
);
}
}
@Test
public
void
testPrinter
()
{
String
fromJson
=
FileHelper
.
readFile
(
new
File
(
getFile
()),
"utf-8"
);
PrinterPagerData
data
=
JsonHelper
.
deserialize
(
fromJson
,
PrinterPagerData
.
class
);
String
toJson
=
JsonHelper
.
serialize
(
data
,
true
);
FileHelper
.
writeFile
(
new
File
(
getTargetFile
()),
toJson
,
"utf-8"
);
}
private
String
getFile
()
{
// 注意,路径应为文件在工程中的相对路径
File
f
=
new
File
(
"src/test/java/helper/from.json"
);
if
(!
f
.
exists
())
{
System
.
out
.
println
(
f
.
getAbsoluteFile
());
throw
new
RuntimeException
(
"视频文件不存在"
);
}
return
f
.
getAbsolutePath
();
}
private
String
getTargetFile
()
{
// 注意,路径应为文件在工程中的相对路径
File
f
=
new
File
(
"target/to.json"
);
return
f
.
getAbsolutePath
();
}
}
}
yzg-util-print/src/test/java/helper/from.json
0 → 100644
View file @
07900627
{
"PageWidth"
:
73
,
"PageHeight"
:
50
,
"MarginTop"
:
125
,
"MarginRight"
:
0
,
"MarginBottom"
:
0
,
"MarginLeft"
:
0
,
"PrintAngle"
:
0
,
"Items"
:[{
"Name"
:
"OrderId"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
4.266013763896241
,
"Left"
:
25.329221810481734
,
"Width"
:
39.926945473795655
,
"Height"
:
4.235044997353096
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"订单编号:{0}"
,
"FormatValue"
:
"订单编号:"
},{
"Name"
:
"createDate"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
14.942985706723134
,
"Left"
:
25.34970884065643
,
"Width"
:
46.9081524616199
,
"Height"
:
4.235044997353096
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"出票时间:{0}"
,
"FormatValue"
:
"出票时间:2019-10-16 16:11:01"
},{
"Name"
:
"codeNo"
,
"Type"
:
2
,
"IsVisible"
:
true
,
"Top"
:
4.51799894123875
,
"Left"
:
5.020275277924827
,
"Width"
:
18.073398623610373
,
"Height"
:
18.073398623610373
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
""
,
"FormatValue"
:
"01234567890123"
},{
"Name"
:
"codeNo"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
9.331815775542616
,
"Left"
:
25.329221810481734
,
"Width"
:
40.72922181048174
,
"Height"
:
4.235044997353096
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"电子券号:{0}"
,
"FormatValue"
:
"电子券号:01234567890123"
},{
"Name"
:
"channelName"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
29.861302276336687
,
"Left"
:
5.065802011646373
,
"Width"
:
43.971678136580195
,
"Height"
:
4.235044997353096
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"渠道来源:{0}"
,
"FormatValue"
:
"渠道来源:窗口"
},{
"Name"
:
"buyNum"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
34.676283748014825
,
"Left"
:
5.067840127051349
,
"Width"
:
33.0574377977766
,
"Height"
:
5.558496559025939
,
"Font"
:
"微软雅黑,12pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"可用人数:{0}"
,
"FormatValue"
:
"可用人数:1"
},{
"Name"
:
"Common"
,
"Type"
:
0
,
"IsVisible"
:
true
,
"Top"
:
40.497617787188986
,
"Left"
:
5.012122816304924
,
"Width"
:
65.82530439385918
,
"Height"
:
8.99947061937533
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"索道门票限当日22:00前使用,巴士门票限当日19:00前使用,一经售出不可退换(北站售)"
,
"FormatValue"
:
"索道门票限当日22:00前使用,巴士门票限当日19:00前使用,一经售出不可退换(北站售)"
},{
"Name"
:
"productName"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
24.795976707252514
,
"Left"
:
5.065802011646373
,
"Width"
:
46.883271572260455
,
"Height"
:
4.235044997353096
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"客票类别:{0}"
,
"FormatValue"
:
"客票类别:途比达门票(自动修改)"
},{
"Name"
:
"PlayerType"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
19.730121757543674
,
"Left"
:
25.329221810481734
,
"Width"
:
26.35322922181048
,
"Height"
:
4.235044997353096
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"游客类型:{0}"
,
"FormatValue"
:
"游客类型:"
},{
"Name"
:
"salePriceTotal"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
34.66225516146109
,
"Left"
:
39.194547379565904
,
"Width"
:
29.2649550026469
,
"Height"
:
5.558496559025939
,
"Font"
:
"微软雅黑,12pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"票价:{0}"
,
"FormatValue"
:
"票价:20"
}]}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment