|
|
@@ -1407,6 +1407,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();
|
|
|
//统计保存的字段
|
|
|
|
|
|
@@ -1526,6 +1527,60 @@ 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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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();
|
|
|
@@ -1704,6 +1759,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
/*需要加载表单公式的时候isFormLoading==true*/
|
|
|
Document document = null;
|
|
|
Map<String, Object> reData = new HashMap<>();
|
|
|
+ //编号
|
|
|
+ Map<String, Object> bhData = new HashMap<>();
|
|
|
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
@@ -1862,7 +1919,38 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
if (trindex <= 10) {
|
|
|
if (StringUtils.isNotBlank(node.getPartitionCode())) {
|
|
|
- reData.put(element.attr("keyName"), node.getPartitionCode());
|
|
|
+ bhData.put(element.attr("keyName"), node.getPartitionCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 编号 //编号为父节点划分编号 “编号:”、“工程编号:”、“编号”、“分项工程编号”、“分部分项编号” 优先使用自己节点,没有编码找寻父级子分项或分项节点
|
|
|
+ if (bhtitle.size() >= 1 && contractInfo.getIsReferenceNumber() == 2) {
|
|
|
+ String nodePartitionCode = "";
|
|
|
+ if(StringUtils.isNotEmpty(node.getPartitionCode())){
|
|
|
+ nodePartitionCode=node.getPartitionCode();
|
|
|
+ }else {
|
|
|
+ if(StringUtils.isNotEmpty(node.getAncestorsPId())){
|
|
|
+ List<WbsTreeContract> list = wbsTreeContractService.getBaseMapper().selectList(Wrappers.<WbsTreeContract>query().lambda().in(WbsTreeContract::getPKeyId, Func.toLongList(",", node.getAncestorsPId())).in(WbsTreeContract::getNodeType, Arrays.asList(4, 5)));
|
|
|
+ if(!list.isEmpty()){
|
|
|
+ // 获取第一个节点类型为5的元素
|
|
|
+ WbsTreeContract result = list.stream().filter(item -> item.getNodeType() == 5).findFirst().orElse(null);
|
|
|
+ if(result!=null&&StringUtils.isNotEmpty(result.getPartitionCode())){
|
|
|
+ nodePartitionCode=result.getPartitionCode();
|
|
|
+ }else {
|
|
|
+ WbsTreeContract result2 = list.stream().filter(item -> item.getNodeType() == 4).findFirst().orElse(null);
|
|
|
+ if(result2!=null&&StringUtils.isNotEmpty(result2.getPartitionCode())){
|
|
|
+ nodePartitionCode=result2.getPartitionCode();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (Element element : bhtitle) {
|
|
|
+ int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
+ if (trindex <= 10) {
|
|
|
+ if (StringUtils.isNotEmpty(nodePartitionCode)) {
|
|
|
+ bhData.put(element.attr("keyName"), nodePartitionCode);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2036,6 +2124,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if(bhData!=null){
|
|
|
+ reData.putAll(bhData);
|
|
|
+ }
|
|
|
// if(reData.size()>0){
|
|
|
// //处理key重复导致pdf数据错位
|
|
|
// for (Iterator<Map.Entry<String, Object>> iterator = reData.entrySet().iterator(); iterator.hasNext(); ) {
|