|
|
@@ -1480,43 +1480,21 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
Element table = doc.select("table").first();
|
|
|
Elements td = table.select("td");
|
|
|
- Map<String, String> set = new HashMap<>();
|
|
|
+ Set<String> set = new HashSet<>();
|
|
|
for (Element element : td) {
|
|
|
- if (element.childNodes().size() >= 2) {
|
|
|
- String title = element.childNodes().get(1).attr("placeholder");
|
|
|
- if (StringUtils.isNotBlank(title)) {
|
|
|
- if (title.contains("&")) {
|
|
|
- // 处理 < 之类的转义字符
|
|
|
- if (title.contains("&")) {
|
|
|
- title = Parser.unescapeEntities(title, false);
|
|
|
- }
|
|
|
- title = Parser.unescapeEntities(title, false);
|
|
|
+ if (element.childNodes().size() >= 1) {
|
|
|
+ element.childNodes().forEach(f->{
|
|
|
+ String title = f.attr("placeholder");
|
|
|
+ if (StringUtils.isNotBlank(title)) {
|
|
|
+ set.add(title);
|
|
|
}
|
|
|
- set.put(title, title);
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
//获取未匹配的字段
|
|
|
List<WbsFormElement> list = new ArrayList<>();
|
|
|
if (set != null && set.size() > 0) {
|
|
|
-// list = baseMapper.getUnMatchField(tabId, set);
|
|
|
- List<WbsFormElement> elements = jdbcTemplate.query("select * from m_wbs_form_element where f_id = ? and is_deleted = 0", new Object[]{tabId}, new BeanPropertyRowMapper<>(WbsFormElement.class));
|
|
|
- elements.forEach(wbsFormElement -> {
|
|
|
- String name = wbsFormElement.getEName();
|
|
|
- if (StringUtils.isNotBlank(name)) {
|
|
|
- if (name.contains("&")) {
|
|
|
- // 处理 < 之类的转义字符
|
|
|
- if (name.contains("&")) {
|
|
|
- name = Parser.unescapeEntities(name, false);
|
|
|
- }
|
|
|
- name = Parser.unescapeEntities(name, false);
|
|
|
- }
|
|
|
- }
|
|
|
- if (set.containsKey(name)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- list.add(wbsFormElement);
|
|
|
- });
|
|
|
+ list = baseMapper.getUnMatchField(tabId, set);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
@@ -1735,6 +1713,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
|
|
|
/*检查发现有p_key_id缺失的情况,导致表单数据丢失,所以强制覆盖*/
|
|
|
dataMap2.put("p_key_id", tableInfo.getPkeyId());
|
|
|
+ dataMap2=isPartition(wbsTreeContract,tabName,dataMap2);
|
|
|
sqlInfo = buildMTableInsertSql(tabName, dataMap2, SnowFlakeUtil.getId(), null, null).toString();
|
|
|
//统计保存的字段
|
|
|
|
|
|
@@ -1854,6 +1833,61 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return R.data(tableInfoList2);
|
|
|
// return R.success(fileName1);
|
|
|
}
|
|
|
+ public LinkedHashMap<String ,String> isPartition(WbsTreeContract wbsTreeContract,String tabName,LinkedHashMap<String, String> dataMap2){
|
|
|
+ //判断是否需要移除编号 当工序 子分项 分项的划分编码有一个不为null就移除编号
|
|
|
+ String sqlContractInfo="select * from m_contract_info where id="+wbsTreeContract.getContractId();
|
|
|
+ ContractInfo contractInfo=jdbcTemplate.queryForObject(sqlContractInfo,new BeanPropertyRowMapper<>(ContractInfo.class));
|
|
|
+ if (contractInfo != null && contractInfo.getIsReferenceNumber() == 2) {
|
|
|
+ Boolean b = isPartition1(wbsTreeContract);
|
|
|
+ if(b){
|
|
|
+ String sqlElement = "select e.* from m_wbs_form_element e left join m_table_info t on e.f_id=t.id where t.tab_en_name='" + tabName+"'";
|
|
|
+ List<WbsFormElement> elements = jdbcTemplate.query(sqlElement, new BeanPropertyRowMapper<>(WbsFormElement.class));
|
|
|
+ if (!elements.isEmpty()) {
|
|
|
+ Map<String, String> bh=new HashMap<>();
|
|
|
+ bh.put("编号","编号");
|
|
|
+ bh.put("编号:","编号");
|
|
|
+ bh.put("编号:","编号");
|
|
|
+ bh.put("工程编号","编号");
|
|
|
+ bh.put("分项工程编号","编号");
|
|
|
+ bh.put("单元工程编码","编号");
|
|
|
+ bh.put("编 号","编号");
|
|
|
+ bh.put("分项工程编号:","编号");
|
|
|
+ bh.put("分项工程编号:","编号");
|
|
|
+ for (WbsFormElement element : elements) {
|
|
|
+ if(bh.containsKey(element.getEName())){
|
|
|
+ dataMap2.remove(element.getEKey());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return dataMap2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return dataMap2;
|
|
|
+ }
|
|
|
+ public Boolean isPartition1(WbsTreeContract wbsTreeContract){
|
|
|
+ if(StringUtils.isNotEmpty(wbsTreeContract.getAncestorsPId())){
|
|
|
+ List<WbsTreeContract> list = wbsTreeContractService.getBaseMapper().selectList(Wrappers.<WbsTreeContract>query().lambda().in(WbsTreeContract::getPKeyId, Func.toLongList(",", wbsTreeContract.getAncestorsPId())).in(WbsTreeContract::getNodeType, Arrays.asList(4,5,6)));
|
|
|
+ if(!list.isEmpty()){
|
|
|
+ // 获取第一个节点类型为6的元素
|
|
|
+ WbsTreeContract result1 = list.stream().filter(item -> item.getNodeType() == 6).findFirst().orElse(null);
|
|
|
+ if(result1!=null&&StringUtils.isNotEmpty(result1.getPartitionCode())){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ // 获取第一个节点类型为5的元素
|
|
|
+ WbsTreeContract result2 = list.stream().filter(item -> item.getNodeType() == 5).findFirst().orElse(null);
|
|
|
+ if(result2!=null&&StringUtils.isNotEmpty(result2.getPartitionCode())){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ WbsTreeContract result3 = list.stream().filter(item -> item.getNodeType() == 4).findFirst().orElse(null);
|
|
|
+ if(result3!=null&&StringUtils.isNotEmpty(result3.getPartitionCode())){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
public String reason(String log) {
|
|
|
/*保存的时候错误提示例如:字段过短提示 yangyj*/
|
|
|
StringBuilder sb = new StringBuilder();
|