提交 ad198e35 authored 作者: 133's avatar 133

[]

上级 0f43dcbc
......@@ -156,16 +156,18 @@ public class JavaToPdfHtmlFreeMarker {
List<DocumentDevice> list=documents.getDocumentDevices();
List<List<DocumentDevice>> listList=toList(list);
int count=listList.size();
for (int i=1; i<=3; i++){
Integer page=1;
for (List<DocumentDevice> list1:listList) {
String htmlname=htmlPath+ UUID.randomUUID().toString()+".html";
// 合并数据模型与模板
FileWriter fileWriter = new FileWriter(new File(htmlname));
template.process(toMap(documents,list1,MAP.get(i)),fileWriter);
template.process(toMap(documents,list1,MAP.get(i),page,count),fileWriter);
out.flush();
strings[index]=htmlname;
index++;
page++;
}
}
return strings;
......@@ -181,7 +183,7 @@ public class JavaToPdfHtmlFreeMarker {
return null;
}
private static Map<String,Object> toMap(Documents documents,List<DocumentDevice> list,String test){
private static Map<String,Object> toMap(Documents documents,List<DocumentDevice> list,String test,Integer page,Integer count){
Map<String,Object> data = new HashMap();
data.put("ul",test);
data.put("number",documents.getNumber());
......@@ -189,6 +191,8 @@ public class JavaToPdfHtmlFreeMarker {
data.put("receiveUnit",documents.getReceiveUnit());
data.put("replyNum",documents.getReplyNum());
data.put("senderUnit",documents.getSenderUnit());
data.put("page",page);
data.put("count",count);
AtomicInteger i= new AtomicInteger(1);
list.forEach(
documentDevice -> {
......@@ -201,9 +205,11 @@ public class JavaToPdfHtmlFreeMarker {
}
private static Map<String,Object> toConfirmMap(Confirm confirm, List<DocumentDevice> list){
private static Map<String,Object> toConfirmMap(Confirm confirm, List<DocumentDevice> list,Integer page,Integer count){
Map<String,Object> data = new HashMap();
data.put("title",confirm.getTitle());
data.put("page",page);
data.put("count",count);
AtomicInteger i= new AtomicInteger(1);
list.forEach(
documentDevice -> {
......@@ -216,13 +222,15 @@ public class JavaToPdfHtmlFreeMarker {
}
private static Map<String,Object> toDestructionMap(Destruction destruction, List<DocumentDevice> list,String test){
private static Map<String,Object> toDestructionMap(Destruction destruction, List<DocumentDevice> list,String test,Integer page,Integer count){
Map<String,Object> data = new HashMap();
data.put("title",destruction.getTitle());
data.put("ul",test);
data.put("unitName",destruction.getDisposeUnitName());
data.put("number",destruction.getNumber());
data.put("time",destruction.getTime());
data.put("page",page);
data.put("count",count);
AtomicInteger i= new AtomicInteger(1);
list.forEach(
documentDevice -> {
......@@ -252,7 +260,7 @@ public class JavaToPdfHtmlFreeMarker {
boolean falg=true;
Integer page=0;
int pageNum = page + 1;
int pageSize = 20;
int pageSize = 19;
Integer totalNum = list.size();
//默认从零分页,这里要考虑这种情况,下面要计算。
......@@ -275,7 +283,7 @@ public class JavaToPdfHtmlFreeMarker {
String htmlname=htmlPath+ UUID.randomUUID().toString()+".html";
// 合并数据模型与模板
FileWriter fileWriter = new FileWriter(new File(htmlname));
template.process(toConfirmMap(confirm,list.subList(startPoint, endPoint)),fileWriter);
template.process(toConfirmMap(confirm,list.subList(startPoint, endPoint),pageNum,totalPage),fileWriter);
out.flush();
strings[index]=htmlname;
index++;
......@@ -353,15 +361,18 @@ public class JavaToPdfHtmlFreeMarker {
template.setEncoding("UTF-8");
List<DocumentDevice> list=destruction.getConfirmDevices();
List<List<DocumentDevice>> listList=toList(list);
Integer count=listList.size();
for (int i=1; i<=3; i++){
Integer page=1;
for (List<DocumentDevice> list1:listList) {
String htmlname=htmlPath+ UUID.randomUUID().toString()+".html";
// 合并数据模型与模板
FileWriter fileWriter = new FileWriter(new File(htmlname));
template.process(toDestructionMap(destruction,list1,MAP.get(i)),fileWriter);
template.process(toDestructionMap(destruction,list1,MAP.get(i),page,count),fileWriter);
out.flush();
strings[index]=htmlname;
index++;
page++;
}
}
return strings;
......
......@@ -13,6 +13,13 @@
@page {
size:210mm 297mm;
}
.bottomTxt {
text-align: center;
font-size: 10px;
color: #646464;
height: 10px;
line-height: 10px;
}
.returnTablePrint{
width: 100%;
height: 100%;
......@@ -150,7 +157,7 @@
}
.returnTablePrint .line3 .left{
border-right: 1px solid #7f7f7f;
height: 106px;
height: 96px;
}
.returnTablePrint .line3 .left>span {
text-indent: 10px;
......@@ -161,7 +168,7 @@
}
.returnTablePrint .line3 .right{
height: 100%;
height: 106px;
height: 96px;
}
.returnTablePrint .line3 .left>span>span:nth-child(2),.returnTablePrint .line3 .right>span>span:nth-child(2){
display: inline-block;
......@@ -363,6 +370,7 @@
</div>
</div>
</div>
<p class="bottomTxt">第${page}页/共${count}页</p >
</div>
<!--<script type="text/javascript">-->
<!--function altRows(id){-->
......
......@@ -17,6 +17,13 @@
/*border: thin solid black;*/
/*padding: 1em;*/
}
.bottomTxt {
text-align: center;
font-size: 10px;
color: #646464;
height: 10px;
line-height: 10px;
}
.returnTablePrint{
width: 100%;
height: 100%;
......@@ -145,7 +152,7 @@
}
.returnTablePrint .line3{
width: 100%;
height: 106px;
height: 50px;
/* box-sizing: border-box; */
/*height:150px;*/
/*display: flex;*/
......@@ -158,7 +165,7 @@
box-sizing: border-box;
/*padding-left: 20px;*/
position: relative;
line-height: 106px;
line-height: 50px;
}
.returnTablePrint .line3 .left{
border-right: 1px solid #7f7f7f;
......@@ -310,12 +317,12 @@
${dev.code}
</#if>
</td>
<td>${dev.model}</td><td>${dev.parts}</td><td>${dev.securityClassification}</td><td>${dev.applicationField}</td>
<td>${dev.model}</td><td>${dev.category}</td><td>${dev.securityClassification}</td><td>${dev.applicationField}</td>
<td>
<#if dev.count != 0>
${dev.count}
</#if>
</td><td style="text-align: left;">${dev.deviceSerialNumber}</td>
</td><td>${dev.deviceSerialNumber}</td>
</tr>
</#list>
</table>
......@@ -351,6 +358,7 @@
</div>
</div>
</div>
<p class="bottomTxt">第${page}页/共${count}页</p >
</div>
</body>
......
......@@ -7,6 +7,13 @@
body{
font-family:SimHei;
}
.bottomTxt {
text-align: center;
font-size: 10px;
color: #646464;
height: 10px;
line-height: 10px;
}
/*@page{size:297mm 210mm;}<!-- 设置PDF页面大小,此配置只对生成PDF文件有效,不会对页面显示生效 -->*/
@page {
size:210mm 297mm;
......@@ -151,7 +158,12 @@
</tr>
<#list documentDevices as dev>
<tr>
<td>${dev.model}</td><td>${dev.model}</td><td>${dev.category}</td><td>${dev.securityClassification}</td><td>${dev.applicationField}</td><td>${dev.deviceSerialNumber}</td>
<td>
<#if dev.code != 0>
${dev.code}
</#if>
</td>
<td>${dev.model}</td><td>${dev.category}</td><td>${dev.securityClassification}</td><td>${dev.applicationField}</td><td>${dev.deviceSerialNumber}</td>
</tr>
</#list>
</table>
......@@ -163,6 +175,7 @@
</div>
</div>
</div>
<p class="bottomTxt">第${page}页/共${count}页</p >
</div>
<!--<script type="text/javascript">-->
<!--function altRows(id){-->
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论