Commit 07900627 authored by yanzg's avatar yanzg

压缩视频

parent 06c2d40c
......@@ -18,50 +18,46 @@ public class PrinterPagerData extends BaseVo {
@JSONField(name = "PageWidth")
private double pageWidth;
/**
* 纸张高度
*/
@JSONField(name = "PageWidth")
@JSONField(name = "PageHeight")
private double pageHeight;
/**
* 左边边距
*/
@JSONField(name = "PageWidth")
@JSONField(name = "MarginLeft")
private double marginLeft;
/**
* 上边边距
*/
@JSONField(name = "PageWidth")
@JSONField(name = "MarginTop")
private double marginTop;
/// 右边边距
@JSONField(name = "PageWidth")
/**
* 右边边距
*/
@JSONField(name = "MarginRight")
private double marginRight;
/// 下边边距
@JSONField(name = "PageWidth")
/**
* 下边边距
*/
@JSONField(name = "MarginBottom")
private double marginBottom;
/**
* 打印角度
*/
@JSONField(name = "PageWidth")
@JSONField(name = "PrintAngle")
private float printAngle;
/**
* 所有页面需要打印得属性
*/
@JSONField(name = "PageWidth")
@JSONField(name = "Items")
private List<PrinterPagerItemData> items;
/**
......@@ -81,7 +77,7 @@ public class PrinterPagerData extends BaseVo {
/**
* 清除位置
*/
private void ClearPosition() {
public void clearPosition() {
this.items.clear();
}
......@@ -90,7 +86,7 @@ public class PrinterPagerData extends BaseVo {
*
* @param to 复制到得对象
*/
public void CopyTo(PrinterPagerData to) {
public void copyTo(PrinterPagerData to) {
to.pageWidth = this.pageWidth;
to.pageHeight = this.pageHeight;
to.marginLeft = this.marginLeft;
......
package helper;
import com.yanzuoguang.util.PrinterHelper;
import com.yanzuoguang.util.helper.FileHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.util.printer.vo.PrinterPagerData;
import org.junit.Test;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public class TestMediaHelper {
public class TestPrinterHelper {
@Test
public void testConvert() {
......@@ -26,4 +29,28 @@ public class TestMediaHelper {
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();
}
}
{"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
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