|
@@ -888,13 +888,28 @@ public class ExcelTabClientImpl implements ExcelTabClient {
|
|
|
JSONArray json2 = new JSONArray();
|
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ json2.add(jsonObject);
|
|
|
String pkeyId = jsonObject.getString("pkeyId");
|
|
|
WbsTreePrivate wbsTreePrivate = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, pkeyId));
|
|
|
+ if(wbsTreePrivate == null || StringUtil.isBlank(wbsTreePrivate.getHtmlUrl())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!StringUtil.hasText(wbsTreePrivate.getInitTableId()) && !StringUtil.hasText(wbsTreePrivate.getInitTableName())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<WbsFormElement> wbsFormElements;
|
|
|
+ if (StringUtil.hasText(wbsTreePrivate.getInitTableId())) {
|
|
|
+ wbsFormElements = jdbcTemplate.query("SELECT e_key from m_wbs_form_element WHERE is_deleted = 0 and e_type = 6 and f_id = " + wbsTreePrivate.getInitTableId(), new BeanPropertyRowMapper<>(WbsFormElement.class) );
|
|
|
+ } else {
|
|
|
+ wbsFormElements = jdbcTemplate.query("SELECT e_key from m_wbs_form_element WHERE e_type = 6 and f_id = (SELECT id from m_table_info WHERE tab_en_name = ' " + wbsTreePrivate.getInitTableName()
|
|
|
+ + "' and is_deleted = 0 limit 1) and is_deleted = 0" + wbsTreePrivate.getInitTableName(), new BeanPropertyRowMapper<>(WbsFormElement.class) );
|
|
|
+ }
|
|
|
+ Map<String, String> map = wbsFormElements.stream().collect(Collectors.toMap(WbsFormElement::getEKey, WbsFormElement::getEKey));
|
|
|
String htmlString = null;
|
|
|
try {
|
|
|
htmlString = IoUtil.readToString(FileUtils.getInputStreamByUrl(wbsTreePrivate.getHtmlUrl()));
|
|
|
} catch (Exception e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
for (Element element : doc.getElementsByAttributeValueStarting("id", "key_")) {
|
|
@@ -902,12 +917,14 @@ public class ExcelTabClientImpl implements ExcelTabClient {
|
|
|
if(id == null || id.startsWith("key__")) {
|
|
|
continue;
|
|
|
}
|
|
|
+ if (map.containsKey(id.split("__")[0])) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
String text = jsonObject.getString(id);
|
|
|
if (text == null || text.trim().isEmpty()) {
|
|
|
jsonObject.put(id, "/");
|
|
|
}
|
|
|
}
|
|
|
- json2.add(jsonObject);
|
|
|
}
|
|
|
return json2;
|
|
|
}
|