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
5f2e30c0
Commit
5f2e30c0
authored
Jun 18, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
压缩视频
parent
b7619f8b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
174 additions
and
18 deletions
+174
-18
PrinterPagerItemData.java
...com/yanzuoguang/util/printer/vo/PrinterPagerItemData.java
+2
-1
TestPrinterHelper.java
yzg-util-print/src/test/java/helper/TestPrinterHelper.java
+18
-17
from_xx.json
yzg-util-print/src/test/java/helper/from_xx.json
+154
-0
No files found.
yzg-util-print/src/main/java/com/yanzuoguang/util/printer/vo/PrinterPagerItemData.java
View file @
5f2e30c0
...
@@ -107,11 +107,12 @@ public class PrinterPagerItemData extends BaseVo {
...
@@ -107,11 +107,12 @@ public class PrinterPagerItemData extends BaseVo {
/**
/**
* 处理字体
* 处理字体
*
* @return
* @return
*/
*/
private
String
initFont
()
{
private
String
initFont
()
{
if
(
this
.
font
!=
null
&&
this
.
font
.
endsWith
(
","
))
{
if
(
this
.
font
!=
null
&&
this
.
font
.
endsWith
(
","
))
{
this
.
font
.
substring
(
0
,
this
.
font
.
length
()
-
1
);
this
.
font
=
this
.
font
.
substring
(
0
,
this
.
font
.
length
()
-
1
);
}
}
return
font
;
return
font
;
}
}
...
...
yzg-util-print/src/test/java/helper/TestPrinterHelper.java
View file @
5f2e30c0
...
@@ -32,10 +32,18 @@ public class TestPrinterHelper {
...
@@ -32,10 +32,18 @@ public class TestPrinterHelper {
@Test
@Test
public
void
testPrinter
()
{
public
void
testPrinter
()
{
String
fromJson
=
FileHelper
.
readFile
(
new
File
(
getFile
()),
"utf-8"
);
String
fromJson
=
FileHelper
.
readFile
(
new
File
(
getFile
(
"from.json"
)),
"utf-8"
);
PrinterPagerData
data
=
JsonHelper
.
deserialize
(
fromJson
,
PrinterPagerData
.
class
);
PrinterPagerData
data
=
JsonHelper
.
deserialize
(
fromJson
,
PrinterPagerData
.
class
);
String
toJson
=
JsonHelper
.
serialize
(
data
,
true
);
String
toJson
=
JsonHelper
.
serialize
(
data
,
true
);
FileHelper
.
writeFile
(
new
File
(
getTargetFile
()),
toJson
,
"utf-8"
);
FileHelper
.
writeFile
(
new
File
(
getTargetFile
(
"to.json"
)),
toJson
,
"utf-8"
);
}
@Test
public
void
testPrinterXx
()
{
String
fromJson
=
FileHelper
.
readFile
(
new
File
(
getFile
(
"from_xx.json"
)),
"utf-8"
);
PrinterPagerData
data
=
JsonHelper
.
deserialize
(
fromJson
,
PrinterPagerData
.
class
);
String
toJson
=
JsonHelper
.
serialize
(
data
,
true
);
FileHelper
.
writeFile
(
new
File
(
getTargetFile
(
"to_xx.json"
)),
toJson
,
"utf-8"
);
}
}
@Test
@Test
...
@@ -50,18 +58,18 @@ public class TestPrinterHelper {
...
@@ -50,18 +58,18 @@ public class TestPrinterHelper {
from
.
put
(
"PlayerType"
,
"游客类型"
);
from
.
put
(
"PlayerType"
,
"游客类型"
);
from
.
put
(
"salePriceTotal"
,
"25"
);
from
.
put
(
"salePriceTotal"
,
"25"
);
String
fromJson
=
FileHelper
.
readFile
(
new
File
(
getFile
()),
"utf-8"
);
String
fromJson
=
FileHelper
.
readFile
(
new
File
(
getFile
(
"from.json"
)),
"utf-8"
);
ConvertPlan
convert
=
PrinterHelper
.
convert
(
fromJson
,
0
,
0
,
from
);
ConvertPlan
convert
=
PrinterHelper
.
convert
Array
(
fromJson
,
0
,
0
,
from
);
FileHelper
.
writeFile
(
new
File
(
getTargetFile
()),
convert
.
getPager
(),
"utf-8"
);
FileHelper
.
writeFile
(
new
File
(
getTargetFile
(
"to_1.json"
)),
convert
.
getPager
(),
"utf-8"
);
String
toJson
=
JsonHelper
.
serialize
(
convert
.
getDatas
(),
true
);
String
toJson
=
JsonHelper
.
serialize
(
convert
.
getDatas
(),
true
);
FileHelper
.
writeFile
(
new
File
(
getTarget
DataFile
(
)),
toJson
,
"utf-8"
);
FileHelper
.
writeFile
(
new
File
(
getTarget
File
(
"to_2_data.json"
)),
toJson
,
"utf-8"
);
}
}
private
String
getFile
()
{
private
String
getFile
(
String
from
)
{
// 注意,路径应为文件在工程中的相对路径
// 注意,路径应为文件在工程中的相对路径
File
f
=
new
File
(
"src/test/java/helper/
from.json"
);
File
f
=
new
File
(
"src/test/java/helper/
"
+
from
);
if
(!
f
.
exists
())
{
if
(!
f
.
exists
())
{
System
.
out
.
println
(
f
.
getAbsoluteFile
());
System
.
out
.
println
(
f
.
getAbsoluteFile
());
throw
new
RuntimeException
(
"视频文件不存在"
);
throw
new
RuntimeException
(
"视频文件不存在"
);
...
@@ -69,17 +77,10 @@ public class TestPrinterHelper {
...
@@ -69,17 +77,10 @@ public class TestPrinterHelper {
return
f
.
getAbsolutePath
();
return
f
.
getAbsolutePath
();
}
}
private
String
getTargetFile
(
String
to
)
{
private
String
getTargetFile
()
{
// 注意,路径应为文件在工程中的相对路径
// 注意,路径应为文件在工程中的相对路径
File
f
=
new
File
(
"target/
to.json"
);
File
f
=
new
File
(
"target/
"
+
to
);
return
f
.
getAbsolutePath
();
return
f
.
getAbsolutePath
();
}
}
private
String
getTargetDataFile
()
{
// 注意,路径应为文件在工程中的相对路径
File
f
=
new
File
(
"target/toData.json"
);
return
f
.
getAbsolutePath
();
}
}
}
yzg-util-print/src/test/java/helper/from_xx.json
0 → 100644
View file @
5f2e30c0
{
"PageWidth"
:
73
,
"PageHeight"
:
50
,
"MarginTop"
:
125
,
"MarginRight"
:
0
,
"MarginBottom"
:
0
,
"MarginLeft"
:
0
,
"PrintAngle"
:
0
,
"Items"
:
[
{
"Name"
:
"codeNo"
,
"Type"
:
2
,
"IsVisible"
:
true
,
"Top"
:
1.9355849655902593
,
"Left"
:
2.399322392800424
,
"Width"
:
20.219031233456857
,
"Height"
:
20.219031233456857
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"01234567890123"
,
"FormatValue"
:
"01234567890123"
},
{
"Name"
:
"codeNo"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
6.087877183695076
,
"Left"
:
24.086818422445738
,
"Width"
:
46.18845950238221
,
"Height"
:
4.499735309687665
,
"Font"
:
"微软雅黑,9pt,style=Bold,Italic,Underline,"
,
"TextAlign"
:
1
,
"Format"
:
"电子券号:{0}"
,
"FormatValue"
:
"电子券号:01234567890123"
},
{
"Name"
:
"createDate"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
11.463102170460562
,
"Left"
:
24.29563260984648
,
"Width"
:
46.99920592906299
,
"Height"
:
5.2938062466913705
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"出票时间:{0}"
,
"FormatValue"
:
"出票时间:2019-10-16 16:11:01"
},
{
"Name"
:
"productName"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
1.0073028057173108
,
"Left"
:
24.29563260984648
,
"Width"
:
42.54896770778189
,
"Height"
:
4.238353626257279
,
"Font"
:
"微软雅黑,9pt,style=Bold"
,
"TextAlign"
:
1
,
"Format"
:
"客票类别:{0}"
,
"FormatValue"
:
"客票类别:途比达门票(自动修改)"
},
{
"Name"
:
"channelName"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
17.1644785600847
,
"Left"
:
24.37673372154579
,
"Width"
:
44.35230280571731
,
"Height"
:
4.499735309687665
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"旅行社:{0}"
,
"FormatValue"
:
"旅行社:窗口"
},
{
"Name"
:
"buyNum"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
22.768501852832188
,
"Left"
:
24.37673372154579
,
"Width"
:
16.979883536262573
,
"Height"
:
4.238353626257279
,
"Font"
:
"微软雅黑,9pt,style=Bold"
,
"TextAlign"
:
1
,
"Format"
:
"人数:{0}"
,
"FormatValue"
:
"人数:1"
},
{
"Name"
:
"Common"
,
"Type"
:
0
,
"IsVisible"
:
true
,
"Top"
:
32.66278454208576
,
"Left"
:
2.794547379565908
,
"Width"
:
68.45897300158813
,
"Height"
:
8.476707252514558
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"门票限当日 22:00 前使用,一经售出不可退换(南站票)"
,
"FormatValue"
:
"门票限当日 22:00 前使用,一经售出不可退换(南站票)"
},
{
"Name"
:
"visitorCardId"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
27.665696135521436
,
"Left"
:
27.99655902593965
,
"Width"
:
34.66119640021175
,
"Height"
:
4.238353626257279
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
" "
,
"FormatValue"
:
" "
},
{
"Name"
:
"sortNo"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
42.024351508734775
,
"Left"
:
2.4116728427739544
,
"Width"
:
25.671651667548968
,
"Height"
:
5.558496559025939
,
"Font"
:
"微软雅黑,12pt,style=Bold"
,
"TextAlign"
:
1
,
"Format"
:
"排号:{0}"
,
"FormatValue"
:
"排号:2"
},
{
"Name"
:
"sortNoTime"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
42.0857596611964
,
"Left"
:
27.561143462149285
,
"Width"
:
145.51032292218105
,
"Height"
:
5.823186871360509
,
"Font"
:
"微软雅黑,9pt,style=Bold"
,
"TextAlign"
:
1
,
"Format"
:
"预计排队进入时间:{0}"
,
"FormatValue"
:
"预计排队进入时间:12:55"
},
{
"Name"
:
"visitorName"
,
"Type"
:
1
,
"IsVisible"
:
true
,
"Top"
:
27.795659078877712
,
"Left"
:
2.4175304393859185
,
"Width"
:
24.477236633139224
,
"Height"
:
4.800820539968237
,
"Font"
:
"微软雅黑,9pt,style=Underline"
,
"TextAlign"
:
1
,
"Format"
:
"导游:{0}"
,
"FormatValue"
:
"导游:颜佐光"
}
]
}
\ 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