导出报销凭证表(签字导出报错)
This commit is contained in:
+53
-18
@@ -134,7 +134,7 @@ public class ActivityReimbursementMineController {
|
||||
} else {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
// cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityReimbursementService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
@@ -184,12 +184,44 @@ public class ActivityReimbursementMineController {
|
||||
NutMap info = (NutMap) sql.getResult();
|
||||
|
||||
String activityContent = info.getString("activityContent");
|
||||
info.put("activityContent", sysOfficeTemplateUtil.convertRichTextToDocText(activityContent));
|
||||
if (activityContent != null) {
|
||||
// 检查是否以<p>标签开头并以</p>标签结尾
|
||||
if (activityContent.startsWith("<p>") && activityContent.endsWith("</p>")) {
|
||||
// 去除最外层的<p>和</p>标签
|
||||
activityContent = activityContent.substring(3, activityContent.length() - 4);
|
||||
}
|
||||
// 对处理后的内容进行富文本转换
|
||||
info.put("activityContent", sysOfficeTemplateUtil.convertRichTextToDocText(activityContent));
|
||||
}
|
||||
|
||||
|
||||
double actualMoneyNum = info.getDouble("actualMoney");
|
||||
// 分离整数和小数部分
|
||||
long integerPart = (long) actualMoneyNum;
|
||||
int decimalPartValue = (int) Math.round((actualMoneyNum - integerPart) * 100);
|
||||
|
||||
// 添加预算金额转换逻辑
|
||||
String actualMoneyChinese = NumberChineseFormatter.format(info.getDouble("actualMoney"), false);
|
||||
// 转换整数部分为中文大写
|
||||
String integerChinese = NumberChineseFormatter.format(integerPart, true) + "元";
|
||||
|
||||
// 处理小数部分
|
||||
String decimalChinese = "";
|
||||
int jiao = decimalPartValue / 10;
|
||||
int fen = decimalPartValue % 10;
|
||||
|
||||
if (jiao > 0) {
|
||||
decimalChinese += NumberChineseFormatter.format(jiao, true) + "角";
|
||||
}
|
||||
if (fen > 0) {
|
||||
decimalChinese += NumberChineseFormatter.format(fen, true) + "分";
|
||||
}
|
||||
|
||||
// 如果没有小数部分,添加"整"字
|
||||
if (decimalChinese.isEmpty()) {
|
||||
decimalChinese = "整";
|
||||
}
|
||||
|
||||
// 组合结果
|
||||
String actualMoneyChinese = integerChinese + decimalChinese;
|
||||
info.put("actualMoney", actualMoneyChinese);
|
||||
|
||||
docData.put("schoolName", Globals.AppName);
|
||||
@@ -200,23 +232,23 @@ public class ActivityReimbursementMineController {
|
||||
|
||||
// 分割整数和小数部分
|
||||
String[] parts = moneyStr.split("\\.");
|
||||
String integerPart = parts[0];
|
||||
String decimalPart = parts.length > 1 ? parts[1] : "00";
|
||||
String integerPartStr = parts[0];
|
||||
String decimalPartStr = parts.length > 1 ? parts[1] : "00";
|
||||
|
||||
// 确保小数部分是两位
|
||||
if (decimalPart.length() < 2) {
|
||||
decimalPart = String.format("%-2s", decimalPart).replace(' ', '0');
|
||||
} else if (decimalPart.length() > 2) {
|
||||
decimalPart = decimalPart.substring(0, 2);
|
||||
if (decimalPartStr.length() < 2) {
|
||||
decimalPartStr = String.format("%-2s", decimalPartStr).replace(' ', '0');
|
||||
} else if (decimalPartStr.length() > 2) {
|
||||
decimalPartStr = decimalPartStr.substring(0, 2);
|
||||
}
|
||||
|
||||
// 处理小数部分(角和分)
|
||||
int jiao = 0, fen = 0;
|
||||
if (decimalPart.length() >= 1) jiao = Character.getNumericValue(decimalPart.charAt(0));
|
||||
if (decimalPart.length() >= 2) fen = Character.getNumericValue(decimalPart.charAt(1));
|
||||
int jiaoDigit = 0, fenDigit = 0;
|
||||
if (decimalPartStr.length() >= 1) jiaoDigit = Character.getNumericValue(decimalPartStr.charAt(0));
|
||||
if (decimalPartStr.length() >= 2) fenDigit = Character.getNumericValue(decimalPartStr.charAt(1));
|
||||
|
||||
// 处理整数部分(各位数值)
|
||||
String reversed = new StringBuilder(integerPart).reverse().toString();
|
||||
String reversed = new StringBuilder(integerPartStr).reverse().toString();
|
||||
String[] units = {"元", "十位", "百位", "千位", "万位", "十万位", "百万位"};
|
||||
Map<String, Integer> digits = new HashMap<>();
|
||||
|
||||
@@ -243,9 +275,9 @@ public class ActivityReimbursementMineController {
|
||||
// seven: 元位
|
||||
digitFields.put("seven", digits.getOrDefault("元", 0));
|
||||
// eight: 角
|
||||
digitFields.put("eight", jiao);
|
||||
digitFields.put("eight", jiaoDigit);
|
||||
// nine: 分
|
||||
digitFields.put("nine", fen);
|
||||
digitFields.put("nine", fenDigit);
|
||||
|
||||
// 将数字字段添加到info中
|
||||
info.putAll(digitFields);
|
||||
@@ -322,8 +354,11 @@ public class ActivityReimbursementMineController {
|
||||
docData.put("xzx", approval);
|
||||
});
|
||||
|
||||
String budgetsStr2 = info.getString("budgets");
|
||||
List<ActivityReimbursementInfo> list = JSONUtil.parseArray(budgetsStr2).toList(ActivityReimbursementInfo.class);
|
||||
String budgetsStr = info.getString("budgets");
|
||||
List<ActivityBudgetVO> list = JSONUtil.parseArray(budgetsStr).toList(ActivityBudgetVO.class);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setRanking(i + 1);
|
||||
}
|
||||
|
||||
docData.put("budgets", list);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user