Commit 38ea11d3 authored by yangyang's avatar yangyang

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents 105101d8 61071ea1
...@@ -285,16 +285,51 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -285,16 +285,51 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
FeignClientResult<Page<JSONObject>> response = jgFeignClient.queryForPage(hashMap); FeignClientResult<Page<JSONObject>> response = jgFeignClient.queryForPage(hashMap);
if (200 == response.getStatus() && ObjectUtils.isNotEmpty(response.getResult())) { if (200 == response.getStatus() && ObjectUtils.isNotEmpty(response.getResult())) {
List<JSONObject> records = response.getResult().getRecords(); List<JSONObject> records = response.getResult().getRecords();
ArrayList<Map<String, Object>> arrayList = new ArrayList<>();
records.forEach(item -> { records.forEach(item -> {
item.remove("SEQUENCE_NBR"); item.remove("SEQUENCE_NBR");
HashMap<String, Object> objectHashMap = new HashMap<>();
for (Map.Entry<String, Object> stringObjectEntry : item.entrySet()) {
objectHashMap.put(convertToCamelCase(stringObjectEntry.getKey()), stringObjectEntry.getValue());
objectHashMap.put(stringObjectEntry.getKey(), stringObjectEntry.getValue());
}
arrayList.add(objectHashMap);
}); });
List<JyjcInspectionApplicationEquipModel> equips = JSON.parseArray(JSON.toJSONString(records), JyjcInspectionApplicationEquipModel.class); map.put("equip", arrayList);
map.put("equip", equips);
} }
map.putAll(attMap); map.putAll(attMap);
return map; return map;
} }
/**
* 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串
*
* @param name 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串
*/
public static String convertToCamelCase(String name) {
StringBuilder result = new StringBuilder();
// 快速检查
if (name == null || name.isEmpty()) {
// 没必要转换
return "";
} else if (!name.contains("_")) {
// 不含下划线,仅将首字母大写
return name.substring(0, 1).toUpperCase() + name.substring(1);
}
// 用下划线将原始字符串分割
String[] camels = name.split("_");
for (String camel : camels) {
// 跳过原始字符串中开头、结尾的下换线或双重下划线
if (camel.isEmpty()) {
continue;
}
// 首字母大写
result.append(camel.substring(0, 1).toUpperCase());
result.append(camel.substring(1).toLowerCase());
}
return result.toString();
}
/** /**
* 接收 * 接收
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment