Browse Source

[合同][修改][开发结算单]

release_toaliyun_real
luozukai 6 years ago
parent
commit
8f09fc9741
3 changed files with 43 additions and 33 deletions
  1. +7
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java
  2. +36
    -32
      mallinkService/src/main/java/com/iformall/utils/WordUtil.java
  3. BIN
      mallinkService/src/main/resources/contract-word-template/settle.docx

+ 7
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java View File

@@ -820,15 +820,21 @@ public class WxBillAllServiceImpl implements WxBillAllService {
for (int i = 0; i < size ; i++) {
WxBillSettleBill bill = i>wxBillSettle.getReceiveBillIds().size()-1?null:wxBillSettle.getReceiveBillIds().get(i);
Map<String,String> map = new HashedMap();
map.put("s1",count+"");
if(bill != null){
map.put("s1",count+"");
map.put("bn1",bill.getBillName());
map.put("money1",bill.getReceivePay());
}else{
map.put("bn1","");
map.put("money1","");
}
WxBillSettleBill payBill = i>wxBillSettle.getPayBillIds().size()-1?null:wxBillSettle.getPayBillIds().get(i);
if(payBill != null){
map.put("bn2",payBill.getBillName());
map.put("money2",payBill.getReceivePay());
}else{
map.put("bn2","");
map.put("money2","");
}
rowsParams.add(map);
count++;


+ 36
- 32
mallinkService/src/main/java/com/iformall/utils/WordUtil.java View File

@@ -105,40 +105,44 @@ public class WordUtil {
if(rows.size()<2){
throw new Exception("tableIndex对应表格应该为2行");
}
//模板的那一行
XWPFTableRow tmpRow = rows.get(2);
List<XWPFTableCell> tmpCells = null;
List<XWPFTableCell> cells = null;
XWPFTableCell tmpCell = null;
tmpCells = tmpRow.getTableCells();

String cellText = null;
String cellTextKey = null;
Map<String,Object> totalMap = null;
for (int i = 0, len = params.size(); i < len; i++) {
Map<String,String> map = params.get(i);
// 创建新的一行
XWPFTableRow row = table.createRow();
// 获取模板的行高 设置为新一行的行高
row.setHeight(tmpRow.getHeight());
cells = row.getTableCells();
for (int k = 0, klen = cells.size(); k < klen; k++) {
tmpCell = tmpCells.get(k);
XWPFTableCell cell = cells.get(k);
cellText = tmpCell.getText();
if (StringUtils.isNotBlank(cellText)) {
//转换为mapkey对应的字段
cellTextKey = cellText.replace("$", "").replace("{", "").replace("}", "");
if (map.containsKey(cellTextKey)) {
// 填充内容 并且复制模板行的属性
setCellText(tmpCell,cell,map.get(cellTextKey));
}
}
}

}
// 删除模版行
table.removeRow(1);
table.addRow(rows.get(2),2);

// //模板的那一行
// XWPFTableRow tmpRow = rows.get(2);
// List<XWPFTableCell> tmpCells = null;
// List<XWPFTableCell> cells2 = null;
// XWPFTableCell tmpCell = null;
// tmpCells = tmpRow.getTableCells();
//
// String cellText = null;
// String cellTextKey = null;
// Map<String,Object> totalMap = null;
// for (int i = 0, len = params.size(); i < len; i++) {
// Map<String,String> map = params.get(i);
// // 创建新的一行
// XWPFTableRow row = table.createRow();
// // 获取模板的行高 设置为新一行的行高
// row.setHeight(tmpRow.getHeight());
// cells = row.a();
// for (int k = 0, klen = tmpCells.size(); k < klen; k++) {
// tmpCell = tmpCells.get(k);
// XWPFTableCell cell = cells.get(k);
// cellText = tmpCell.getText();
// if (StringUtils.isNotBlank(cellText)) {
// //转换为mapkey对应的字段
// cellTextKey = cellText.replace("$", "").replace("{", "").replace("}", "");
// if (map.containsKey(cellTextKey)) {
// // 填充内容 并且复制模板行的属性
// setCellText(tmpCell,cell,map.get(cellTextKey));
// }
// }
// }
//
// }
// // 删除模版行
// table.removeRow(2);
}

/**


BIN
mallinkService/src/main/resources/contract-word-template/settle.docx View File


Loading…
Cancel
Save