Commit 5f2e30c0 authored by yanzg's avatar yanzg

压缩视频

parent b7619f8b
......@@ -107,11 +107,12 @@ public class PrinterPagerItemData extends BaseVo {
/**
* 处理字体
*
* @return
*/
private String initFont() {
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;
}
......
......@@ -32,10 +32,18 @@ public class TestPrinterHelper {
@Test
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);
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
......@@ -50,18 +58,18 @@ public class TestPrinterHelper {
from.put("PlayerType", "游客类型");
from.put("salePriceTotal", "25");
String fromJson = FileHelper.readFile(new File(getFile()), "utf-8");
ConvertPlan convert = PrinterHelper.convert(fromJson, 0, 0, from);
String fromJson = FileHelper.readFile(new File(getFile("from.json")), "utf-8");
ConvertPlan convert = PrinterHelper.convertArray(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);
FileHelper.writeFile(new File(getTargetDataFile()), toJson, "utf-8");
FileHelper.writeFile(new File(getTargetFile("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()) {
System.out.println(f.getAbsoluteFile());
throw new RuntimeException("视频文件不存在");
......@@ -69,17 +77,10 @@ public class TestPrinterHelper {
return f.getAbsolutePath();
}
private String getTargetFile() {
private String getTargetFile(String to) {
// 注意,路径应为文件在工程中的相对路径
File f = new File("target/to.json");
File f = new File("target/" + to);
return f.getAbsolutePath();
}
private String getTargetDataFile() {
// 注意,路径应为文件在工程中的相对路径
File f = new File("target/toData.json");
return f.getAbsolutePath();
}
}
{
"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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment