|
@@ -161,20 +161,22 @@ public class McYdServiceImpl implements McYdService {
|
|
|
.formInstId(formInstId)
|
|
|
.build(), YDConf.FORM_QUERY.retrieve_id);
|
|
|
Map formData = ddrNew.getFormData();
|
|
|
- List<Map> table = (List<Map>) formData.get(tableField);
|
|
|
- for (Map item : table) {
|
|
|
- String[] numberFieldCodes=numberFieldCode.split(",");
|
|
|
- String[] textFieldCodes=textFieldCode.split(",");
|
|
|
- for (int i = 0; i < numberFieldCodes.length; i++) {
|
|
|
- BigDecimal number = NumberUtil.toBigDecimal(UtilMap.getNumberStr(item,numberFieldCodes[i]));
|
|
|
- // 创建一个 DecimalFormat 实例,指定千位分隔符模式
|
|
|
- DecimalFormat df = new DecimalFormat("#,###.00");
|
|
|
-
|
|
|
- // 格式化 double 数值
|
|
|
- String formattedText = df.format(number);
|
|
|
- item.put(textFieldCodes[i],formattedText);
|
|
|
+ Map updateMap=new HashMap();
|
|
|
+ if (!PublicUtil.isNull(tableField)&&tableField.startsWith("tableField_")) {
|
|
|
+ List<Map<String, ?>> table = UtilMap.getList( formData,(tableField));
|
|
|
+ for (Map item : table) {
|
|
|
+ String[] numberFieldCodes=numberFieldCode.split(",");
|
|
|
+ String[] textFieldCodes=textFieldCode.split(",");
|
|
|
+ for (int i = 0; i < numberFieldCodes.length; i++) {
|
|
|
+ BigDecimal number = NumberUtil.toBigDecimal(UtilMap.getNumberStr(item,numberFieldCodes[i]));
|
|
|
+ // 创建一个 DecimalFormat 实例,指定千位分隔符模式
|
|
|
+ DecimalFormat df = new DecimalFormat("#,###.00");
|
|
|
+ // 格式化 double 数值
|
|
|
+ String formattedText = df.format(number);
|
|
|
+ item.put(textFieldCodes[i],formattedText);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+ updateMap.put(tableField,getTableData(table)); // 添加一层过滤
|
|
|
}
|
|
|
|
|
|
if(!PublicUtil.isNull(map,"mainNumKeys","mainTextKeys")){
|
|
@@ -186,14 +188,14 @@ public class McYdServiceImpl implements McYdService {
|
|
|
DecimalFormat df = new DecimalFormat("#,###.00");
|
|
|
// 格式化 double 数值
|
|
|
String formattedText = df.format(number);
|
|
|
- formData.put(mainTextKeys[i],formattedText);
|
|
|
+ updateMap.put(mainTextKeys[i],formattedText);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
ydClient.operateData(YDParam.builder()
|
|
|
.formInstId(formInstId)
|
|
|
.useLatestVersion(true)
|
|
|
- .updateFormDataJson(JSONObject.toJSONString(formData))
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(updateMap))
|
|
|
.build(), YDConf.FORM_OPERATION.update);
|
|
|
}
|
|
|
|
|
@@ -204,4 +206,27 @@ public class McYdServiceImpl implements McYdService {
|
|
|
return obj == null ? "" : obj.toString();
|
|
|
}
|
|
|
|
|
|
+ private List<Map> getTableData(List<Map<String, ?>> details){
|
|
|
+ List<Map> table = new ArrayList<>();
|
|
|
+ for (Map detail : details) {
|
|
|
+ Map row = UtilMap.empty();
|
|
|
+ for (String subId : details.get(0).keySet()) {
|
|
|
+ // ppExt: 组件会返回带有_id/_value字段, 关联表单 & 成员组件赋值为原字段 [关联表单仅仅会返回带Id字段, 成员组件不带Id返回姓名过滤]
|
|
|
+ if (subId.endsWith("_value") || (subId.startsWith("employeeField_") && !subId.endsWith("_id"))) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (subId.endsWith("_id")) {
|
|
|
+ if (subId.startsWith("employeeField_") || subId.startsWith("associationFormField_")) {
|
|
|
+ subId = subId.replace("_id", "");
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ row.put(subId, YDConf.getDataByCompId(detail, subId));
|
|
|
+ }
|
|
|
+
|
|
|
+ table.add(row);
|
|
|
+ }
|
|
|
+ return table;
|
|
|
+ }
|
|
|
}
|