|
@@ -2130,6 +2130,11 @@ public class contractApproveController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // =========================================================================
|
|
|
|
|
+ // 新增:计算中文大写金额
|
|
|
|
|
+ // =========================================================================
|
|
|
|
|
+ String requestAmountCn = convertNumberToChinese(requestAmountTotal);
|
|
|
|
|
+
|
|
|
// 3. 创建支付请求单主表(Process Instance + BO)
|
|
// 3. 创建支付请求单主表(Process Instance + BO)
|
|
|
String mainPayRequestId = planIds[0];
|
|
String mainPayRequestId = planIds[0];
|
|
|
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance(
|
|
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance(
|
|
@@ -2141,6 +2146,11 @@ public class contractApproveController {
|
|
|
BO mainPayRequestBO = new BO();
|
|
BO mainPayRequestBO = new BO();
|
|
|
mainPayRequestBO.setBindId(processInstance.getId());
|
|
mainPayRequestBO.setBindId(processInstance.getId());
|
|
|
mainPayRequestBO.set("REQUEST_AMOUNT", requestAmountTotal);
|
|
mainPayRequestBO.set("REQUEST_AMOUNT", requestAmountTotal);
|
|
|
|
|
+ // =========================================================================
|
|
|
|
|
+ // 新增:为主表BO设置中文大写金额字段
|
|
|
|
|
+ // =========================================================================
|
|
|
|
|
+ mainPayRequestBO.set("REQUEST_AMOUNT_CN", requestAmountCn);
|
|
|
|
|
+
|
|
|
SDK.getBOAPI().create("BO_EU_DNIVT_PAY_REQUEST", mainPayRequestBO, processInstance, uc);
|
|
SDK.getBOAPI().create("BO_EU_DNIVT_PAY_REQUEST", mainPayRequestBO, processInstance, uc);
|
|
|
SDK.getProcessAPI().start(processInstance);
|
|
SDK.getProcessAPI().start(processInstance);
|
|
|
|
|
|
|
@@ -2195,6 +2205,111 @@ public class contractApproveController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 将 BigDecimal 金额转换为中文大写金额字符串
|
|
|
|
|
+ * @param amount 金额
|
|
|
|
|
+ * @return 中文大写金额
|
|
|
|
|
+ */
|
|
|
|
|
+ private static String convertNumberToChinese(BigDecimal amount) {
|
|
|
|
|
+ if (amount == null) {
|
|
|
|
|
+ throw new IllegalArgumentException("输入金额不能为null");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (amount.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
|
|
+ throw new IllegalArgumentException("金额不能为负数");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (amount.compareTo(new BigDecimal("999999999999.99")) > 0) {
|
|
|
|
|
+ throw new IllegalArgumentException("金额超出范围(最大支持到 999,999,999,999.99)");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 处理整数和小数部分
|
|
|
|
|
+ BigDecimal integerPart = amount.setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
|
+ BigDecimal decimalPart = amount.subtract(integerPart).multiply(new BigDecimal("100")).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+
|
|
|
|
|
+ final String[] chineseDigits = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
|
|
|
|
|
+ final String[] chineseUnits = {"", "拾", "佰", "仟"};
|
|
|
|
|
+ final String[] chineseSections = {"", "万", "亿"};
|
|
|
|
|
+
|
|
|
|
|
+ String integerStr = convertInteger(integerPart, chineseDigits, chineseUnits, chineseSections);
|
|
|
|
|
+ String decimalStr = convertDecimal(decimalPart, chineseDigits);
|
|
|
|
|
+
|
|
|
|
|
+ if (decimalStr.isEmpty()) {
|
|
|
|
|
+ decimalStr = "整";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return integerStr + (integerStr.equals("零") ? "" : "元") + decimalStr;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 转换整数部分
|
|
|
|
|
+ */
|
|
|
|
|
+ private static String convertInteger(BigDecimal num, String[] digits, String[] units, String[] sections) {
|
|
|
|
|
+ if (num.compareTo(BigDecimal.ZERO) == 0) return "零";
|
|
|
|
|
+
|
|
|
|
|
+ StringBuilder result = new StringBuilder();
|
|
|
|
|
+ int sectionIndex = 0;
|
|
|
|
|
+
|
|
|
|
|
+ while (num.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
|
+ BigDecimal section = num.remainder(new BigDecimal("10000"));
|
|
|
|
|
+ if (section.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
|
+ String sectionStr = convertSection(section, digits, units);
|
|
|
|
|
+ if (sectionIndex > 0) {
|
|
|
|
|
+ sectionStr += sections[sectionIndex];
|
|
|
|
|
+ }
|
|
|
|
|
+ result.insert(0, sectionStr);
|
|
|
|
|
+ } else if (result.length() > 0 && !result.toString().startsWith("零")) {
|
|
|
|
|
+ result.insert(0, "零");
|
|
|
|
|
+ }
|
|
|
|
|
+ num = num.divide(new BigDecimal("10000"), 0, BigDecimal.ROUND_DOWN);
|
|
|
|
|
+ sectionIndex++;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String res = result.toString().replaceAll("^零+|零+$", "").replaceAll("零{2,}", "零");
|
|
|
|
|
+ return res.isEmpty() ? "零" : res;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 转换单个四位数
|
|
|
|
|
+ */
|
|
|
|
|
+ private static String convertSection(BigDecimal section, String[] digits, String[] units) {
|
|
|
|
|
+ StringBuilder result = new StringBuilder();
|
|
|
|
|
+ boolean zeroNeeded = false;
|
|
|
|
|
+ String numStr = String.format("%04d", section.intValue()); // 格式化为4位字符串,不足补0
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < 4; i++) {
|
|
|
|
|
+ int digit = Character.getNumericValue(numStr.charAt(i));
|
|
|
|
|
+ int power = 3 - i; // 仟、佰、拾、个
|
|
|
|
|
+ if (digit != 0) {
|
|
|
|
|
+ if (zeroNeeded) {
|
|
|
|
|
+ result.append(digits[0]);
|
|
|
|
|
+ zeroNeeded = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ result.append(digits[digit]).append(units[power]);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (result.length() > 0 && power < 3) {
|
|
|
|
|
+ zeroNeeded = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return result.toString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 转换小数部分
|
|
|
|
|
+ */
|
|
|
|
|
+ private static String convertDecimal(BigDecimal dec, String[] digits) {
|
|
|
|
|
+ if (dec.compareTo(BigDecimal.ZERO) == 0) return "";
|
|
|
|
|
+ int jiao = dec.divide(new BigDecimal("10"), 0, BigDecimal.ROUND_DOWN).intValue();
|
|
|
|
|
+ int fen = dec.remainder(new BigDecimal("10")).intValue();
|
|
|
|
|
+ StringBuilder result = new StringBuilder();
|
|
|
|
|
+ if (jiao > 0) {
|
|
|
|
|
+ result.append(digits[jiao]).append("角");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (fen > 0) {
|
|
|
|
|
+ result.append(digits[fen]).append("分");
|
|
|
|
|
+ }
|
|
|
|
|
+ return result.toString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Mapping("com.awspaas.user.apps.donenow_ctt.getAllPaymentAmounts")
|
|
@Mapping("com.awspaas.user.apps.donenow_ctt.getAllPaymentAmounts")
|
|
|
public ResponseObject getAllPaymentAmounts(UserContext uc) throws SQLException {
|
|
public ResponseObject getAllPaymentAmounts(UserContext uc) throws SQLException {
|
|
|
Connection conn = null;
|
|
Connection conn = null;
|