在数据源代码中加入如下代码
for (Map map : list) {
Set set = map.entrySet();
Iterator it = set.iterator();
while (it.hasNext()) {
String column = it.next().toString();
column = column.substring(0,column.indexOf("="));
map.put(column, pmsKeyvalueNumberService.changeNumberLengthByPdf(map.get(column)));
}
}
/**
* 去掉末尾的0
*
* @param number
* @return
*/
public Object changeNumberLengthByPdf(Object number) {
String num = number.toString();
if (num.indexOf(".") > -1 && num.indexOf("0") > -1) {
int index = num.indexOf(".");
int length = num.length();
//从小数点到最后一位的长度
for (int i = 0; i < length - index; i++) {
String n = num.substring(length - i - 1, length - i);
if (!"0".equals(n) && !".".equals(n)) {
break;
}
num = num.substring(0, length - i - 1);
}
return num;
}
return number;
}
}
参考:nxhzzzq工程技术研究中心建设项目验收申请表 gczx_yssq
java文件PdfUnifiedEntranceService.java getPmsProjectfeatureinfor方法处