|
@@ -47,6 +47,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.LinkedCaseInsensitiveMap;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.*;
|
|
@@ -679,6 +680,18 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
List<String> resultAddData = new ArrayList<>();
|
|
|
Map<String, List<InsertDataVO>> maps = resultData.stream().filter(f -> f.getKey().contains("key_")).collect(Collectors.groupingBy(InsertDataVO::getInitTabName));
|
|
|
|
|
|
+ //对应入库的监理表的所有有效字段
|
|
|
+ Map<String, List<String>> filedTabMaps = new LinkedHashMap<>();
|
|
|
+ Set<String> initTabNames = maps.keySet();
|
|
|
+ for (String initTabName : initTabNames) {
|
|
|
+ List<QueryProcessDataVO> tabColsAllByTabName = informationQueryClient.getNodeChildTabColsAllByTabName(initTabName);
|
|
|
+ List<String> keys = tabColsAllByTabName.stream().map(QueryProcessDataVO::getAncestors).collect(Collectors.toList());
|
|
|
+ if (keys.size() > 0) {
|
|
|
+ filedTabMaps.put(initTabName, keys);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //数据处理
|
|
|
for (Map.Entry<String, List<InsertDataVO>> oneTabData : maps.entrySet()) {
|
|
|
String initTabName = oneTabData.getKey();
|
|
|
List<InsertDataVO> dataValue = oneTabData.getValue();
|
|
@@ -688,11 +701,17 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
pKeyIdJL = collect.stream().findAny().orElse(null);
|
|
|
}
|
|
|
|
|
|
+ //监理表的所有有效字段
|
|
|
+ List<String> keysAll = Func.toStrList(filedTabMaps.get(initTabName).get(0));
|
|
|
+
|
|
|
StringBuilder dataSql = new StringBuilder();
|
|
|
List<String> keys = new LinkedList<>();
|
|
|
List<String> values = new LinkedList<>();
|
|
|
for (InsertDataVO vo : dataValue) {
|
|
|
String key = vo.getKey();
|
|
|
+ if (!keysAll.contains(key)) {
|
|
|
+ continue; //如果key不在监理表keysAll中,就跳过
|
|
|
+ }
|
|
|
keys.add(key);
|
|
|
String data = vo.getData();
|
|
|
values.add(data);
|
|
@@ -746,7 +765,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
String nodeNameRe = split[0];
|
|
|
String pKeyId = split[1];
|
|
|
String initTabName = sgTab.getValue();
|
|
|
- //质检html
|
|
|
+
|
|
|
String htmlString = this.getHtmlString(pKeyId);
|
|
|
|
|
|
for (Map.Entry<String, String> jlTab : jlData.entrySet()) { //监理表
|
|
@@ -754,7 +773,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
String nodeNameReJL = splitJl[0];
|
|
|
String pKeyIdJL = splitJl[1];
|
|
|
String initTabNameJL = jlTab.getValue();
|
|
|
- //监理html
|
|
|
+
|
|
|
String htmlStringJL = this.getHtmlString(pKeyIdJL);
|
|
|
|
|
|
//表的代码名称相同,则复制数据,例如:G10=G10
|
|
@@ -762,9 +781,11 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
//获取质检实体表对应数据
|
|
|
List<Map<String, Object>> mapsList = jdbcTemplate.queryForList("select * from " + initTabName + " where p_key_id = " + pKeyId);
|
|
|
if (mapsList.size() > 0) {
|
|
|
- Map<String, Object> maps = mapsList.get(0);
|
|
|
- maps.entrySet().removeIf(entry -> entry.getValue() == null); //排查空字段
|
|
|
- for (Map.Entry<String, Object> obj : maps.entrySet()) {
|
|
|
+ LinkedCaseInsensitiveMap<Object> maps = (LinkedCaseInsensitiveMap<Object>) mapsList.get(0);
|
|
|
+ LinkedHashMap<String, Object> resultMaps = new LinkedHashMap<>(maps);
|
|
|
+ resultMaps.entrySet().removeIf(entry -> entry.getValue() == null || entry.getValue().toString().trim().isEmpty()); //排除空串
|
|
|
+
|
|
|
+ for (Map.Entry<String, Object> obj : resultMaps.entrySet()) {
|
|
|
String key = obj.getKey();
|
|
|
Object value = obj.getValue();
|
|
|
|
|
@@ -778,6 +799,10 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
if (StringUtils.isNotEmpty(htmlString)) {
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
Elements td = doc.select("el-input[keyname~=" + findIndex + ".*]");
|
|
|
+ if (td.size() == 0) {
|
|
|
+ //日期格式
|
|
|
+ td = doc.select("el-date-picker[keyname~=" + findIndex + ".*]");
|
|
|
+ }
|
|
|
String placeholderValue = "";
|
|
|
if (td.size() >= 1) {
|
|
|
for (Element element : td) {
|
|
@@ -786,11 +811,15 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //警告跳过
|
|
|
- if (!placeholderValue.contains("警告")) {
|
|
|
+ //警告,空串跳过
|
|
|
+ if (!placeholderValue.contains("警告") && StringUtils.isNotEmpty(placeholderValue)) {
|
|
|
if (StringUtils.isNotEmpty(htmlStringJL)) {
|
|
|
Document docJL = Jsoup.parse(htmlStringJL);
|
|
|
Elements tdJL = docJL.select("el-input[placeholderxx~=" + this.escapeRegex(placeholderValue) + ".*]");
|
|
|
+ if (tdJL.size() == 0) {
|
|
|
+ //日期格式
|
|
|
+ tdJL = docJL.select("el-date-picker[keyname~=" + this.escapeRegex(placeholderValue) + ".*]");
|
|
|
+ }
|
|
|
if (tdJL.size() >= 1) {
|
|
|
for (Element element : tdJL) {
|
|
|
String keyname = element.attr("keyname");
|
|
@@ -802,11 +831,13 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
InsertDataVO vo = new InsertDataVO();
|
|
|
vo.setPKeyId(pKeyIdJL);
|
|
|
vo.setInitTabName(initTabNameJL);
|
|
|
- vo.setKey(keyJL);
|
|
|
- vo.setData(data + "_^_" + keyJLIndex);
|
|
|
- resultData.add(vo);
|
|
|
- break;
|
|
|
+ if (keyJL.length() > 3) { //排除key=key的时候,也就是找不到key值,正常为key_X
|
|
|
+ vo.setKey(keyJL);
|
|
|
+ vo.setData(data + "_^_" + keyJLIndex);
|
|
|
+ resultData.add(vo);
|
|
|
+ }
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -828,6 +859,10 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
if (StringUtils.isNotEmpty(htmlString)) {
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
Elements td = doc.select("el-input[keyname~=" + findIndex + ".*]");
|
|
|
+ if (td.size() == 0) {
|
|
|
+ //日期格式
|
|
|
+ td = doc.select("el-date-picker[keyname~=" + findIndex + ".*]");
|
|
|
+ }
|
|
|
String placeholderValue = "";
|
|
|
if (td.size() >= 1) {
|
|
|
for (Element element : td) {
|
|
@@ -836,11 +871,15 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //警告跳过
|
|
|
- if (!placeholderValue.contains("警告")) {
|
|
|
+ //警告,空串跳过
|
|
|
+ if (!placeholderValue.contains("警告") && StringUtils.isNotEmpty(placeholderValue)) {
|
|
|
if (StringUtils.isNotEmpty(htmlStringJL)) {
|
|
|
Document docJL = Jsoup.parse(htmlStringJL);
|
|
|
Elements tdJL = docJL.select("el-input[placeholderxx~=" + this.escapeRegex(placeholderValue) + ".*]");
|
|
|
+ if (tdJL.size() == 0) {
|
|
|
+ //日期格式
|
|
|
+ tdJL = docJL.select("el-date-picker[keyname~=" + this.escapeRegex(placeholderValue) + ".*]");
|
|
|
+ }
|
|
|
if (tdJL.size() >= 1) {
|
|
|
for (Element element : tdJL) {
|
|
|
String keyname = element.attr("keyname");
|
|
@@ -849,15 +888,16 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
String keyJL = keynameJL[0];
|
|
|
if (keyJL.length() > 3) { //排除key=key的时候,也就是找不到key值,正常为key_X
|
|
|
String keyJLIndex = keynameJL[1];
|
|
|
- values.add(data + "_^_" + keyJLIndex + "---" + keyJL);
|
|
|
- break;
|
|
|
+ if (keyJLIndex.equals(index)) { //位置相同才复制
|
|
|
+ values.add(data + "_^_" + keyJLIndex + "---" + keyJL);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|