|
@@ -566,7 +566,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
Map<String, String> jlCopyNodeMaps = new LinkedHashMap<>();
|
|
Map<String, String> jlCopyNodeMaps = new LinkedHashMap<>();
|
|
|
|
|
|
List<WbsTreeContract> tabs = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getParentId, node.getId())
|
|
List<WbsTreeContract> tabs = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getParentId, node.getId())
|
|
- .select(WbsTreeContract::getNodeName, WbsTreeContract::getTableOwner, WbsTreeContract::getPKeyId, WbsTreeContract::getInitTableName, WbsTreeContract::getSort, WbsTreeContract::getFullName, WbsTreeContract::getUpdateTime, WbsTreeContract::getOldId)
|
|
|
|
|
|
+ .select(WbsTreeContract::getNodeName, WbsTreeContract::getTableOwner, WbsTreeContract::getPKeyId, WbsTreeContract::getInitTableName, WbsTreeContract::getSort, WbsTreeContract::getFullName, WbsTreeContract::getUpdateTime)
|
|
.eq(WbsTreeContract::getContractId, node.getContractId()).eq(WbsTreeContract::getType, 2)
|
|
.eq(WbsTreeContract::getContractId, node.getContractId()).eq(WbsTreeContract::getType, 2)
|
|
.eq(WbsTreeContract::getWbsId, node.getWbsId()).eq(WbsTreeContract::getWbsType, node.getWbsType())
|
|
.eq(WbsTreeContract::getWbsId, node.getWbsId()).eq(WbsTreeContract::getWbsType, node.getWbsType())
|
|
.eq(WbsTreeContract::getStatus, 1));
|
|
.eq(WbsTreeContract::getStatus, 1));
|
|
@@ -620,13 +620,13 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
for (WbsTreeContract wbsTreeContract : sgTabSort) {
|
|
for (WbsTreeContract wbsTreeContract : sgTabSort) {
|
|
- if (wbsTreeContract.getOldId() == null && !wbsTreeContract.getNodeName().contains("_PL_")) {
|
|
|
|
- //施工原始表
|
|
|
|
- String s = extractAlphameric(wbsTreeContract.getNodeName());
|
|
|
|
- if (StringUtils.isNotEmpty(s)) {
|
|
|
|
- sgYsNodeMaps.put(s + "---" + wbsTreeContract.getPKeyId(), wbsTreeContract.getInitTableName());
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
|
|
+ //if (wbsTreeContract.getOldId() == null && !wbsTreeContract.getNodeName().contains("_PL_")) {
|
|
|
|
+ //质检表
|
|
|
|
+ String s = extractAlphameric(wbsTreeContract.getNodeName());
|
|
|
|
+ if (StringUtils.isNotEmpty(s)) {
|
|
|
|
+ sgYsNodeMaps.put(s + "---" + wbsTreeContract.getPKeyId(), wbsTreeContract.getInitTableName());
|
|
|
|
+ }
|
|
|
|
+ /*} else {
|
|
//复制表
|
|
//复制表
|
|
if (wbsTreeContract.getNodeName().contains("__")) {
|
|
if (wbsTreeContract.getNodeName().contains("__")) {
|
|
String s = extractAlphameric(wbsTreeContract.getNodeName());
|
|
String s = extractAlphameric(wbsTreeContract.getNodeName());
|
|
@@ -641,17 +641,16 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
sgPLNodeMaps.put(s + "---" + wbsTreeContract.getPKeyId(), wbsTreeContract.getInitTableName());
|
|
sgPLNodeMaps.put(s + "---" + wbsTreeContract.getPKeyId(), wbsTreeContract.getInitTableName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
for (WbsTreeContract wbsTreeContract : jlTabSort) {
|
|
for (WbsTreeContract wbsTreeContract : jlTabSort) {
|
|
- if (wbsTreeContract.getOldId() == null && !wbsTreeContract.getNodeName().contains("_PL_")) {
|
|
|
|
- //监理原始表
|
|
|
|
- String s = extractAlphameric(wbsTreeContract.getNodeName());
|
|
|
|
- if (StringUtils.isNotEmpty(s)) {
|
|
|
|
- jlYsNodeMaps.put(s + "---" + wbsTreeContract.getPKeyId(), wbsTreeContract.getInitTableName());
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
|
|
+ //if (wbsTreeContract.getOldId() == null && !wbsTreeContract.getNodeName().contains("_PL_")) {
|
|
|
|
+ //监理表
|
|
|
|
+ String s = extractAlphameric(wbsTreeContract.getNodeName());
|
|
|
|
+ if (StringUtils.isNotEmpty(s)) {
|
|
|
|
+ jlYsNodeMaps.put(s + "---" + wbsTreeContract.getPKeyId(), wbsTreeContract.getInitTableName());
|
|
|
|
+ }
|
|
|
|
+ /*} else {
|
|
//复制表
|
|
//复制表
|
|
if (wbsTreeContract.getNodeName().contains("__")) {
|
|
if (wbsTreeContract.getNodeName().contains("__")) {
|
|
String s = extractAlphameric(wbsTreeContract.getNodeName());
|
|
String s = extractAlphameric(wbsTreeContract.getNodeName());
|
|
@@ -666,7 +665,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
jlPLNodeMaps.put(s + "---" + wbsTreeContract.getPKeyId(), wbsTreeContract.getInitTableName());
|
|
jlPLNodeMaps.put(s + "---" + wbsTreeContract.getPKeyId(), wbsTreeContract.getInitTableName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
|
|
|
|
//构造表数据
|
|
//构造表数据
|
|
@@ -677,7 +676,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
|
|
|
//入库处理
|
|
//入库处理
|
|
if (resultData.size() > 0) {
|
|
if (resultData.size() > 0) {
|
|
- List<String> resultAddData = new ArrayList<>();
|
|
|
|
|
|
+ List<String> resultSQLS = new ArrayList<>();
|
|
Map<String, List<InsertDataVO>> maps = resultData.stream().filter(f -> f.getKey().contains("key_")).collect(Collectors.groupingBy(InsertDataVO::getInitTabName));
|
|
Map<String, List<InsertDataVO>> maps = resultData.stream().filter(f -> f.getKey().contains("key_")).collect(Collectors.groupingBy(InsertDataVO::getInitTabName));
|
|
|
|
|
|
//对应入库的监理表的所有有效字段
|
|
//对应入库的监理表的所有有效字段
|
|
@@ -695,50 +694,50 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
for (Map.Entry<String, List<InsertDataVO>> oneTabData : maps.entrySet()) {
|
|
for (Map.Entry<String, List<InsertDataVO>> oneTabData : maps.entrySet()) {
|
|
String initTabName = oneTabData.getKey();
|
|
String initTabName = oneTabData.getKey();
|
|
List<InsertDataVO> dataValue = oneTabData.getValue();
|
|
List<InsertDataVO> dataValue = oneTabData.getValue();
|
|
- List<String> collect = dataValue.stream().map(InsertDataVO::getPKeyId).distinct().collect(Collectors.toList());
|
|
|
|
- String pKeyIdJL = "";
|
|
|
|
- if (collect.size() == 1) {
|
|
|
|
- pKeyIdJL = collect.stream().findAny().orElse(null);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
//监理表的所有有效字段
|
|
//监理表的所有有效字段
|
|
List<String> keysAll = Func.toStrList(filedTabMaps.get(initTabName).get(0));
|
|
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中,就跳过
|
|
|
|
|
|
+ //一张实体表中,多组数据,复制表共用同一张实体表,只是pKeyId不同
|
|
|
|
+ Map<String, List<InsertDataVO>> oneTab = dataValue.stream().collect(Collectors.groupingBy(InsertDataVO::getPKeyId));
|
|
|
|
+
|
|
|
|
+ for (Map.Entry<String, List<InsertDataVO>> tab : oneTab.entrySet()) {
|
|
|
|
+ String tabPKeyId = tab.getKey();
|
|
|
|
+ List<InsertDataVO> tabData = tab.getValue();
|
|
|
|
+ StringBuilder dataSql = new StringBuilder();
|
|
|
|
+ List<String> keys = new LinkedList<>();
|
|
|
|
+ List<String> values = new LinkedList<>();
|
|
|
|
+ for (InsertDataVO vo : tabData) {
|
|
|
|
+ String key = vo.getKey();
|
|
|
|
+ if (!keysAll.contains(key)) {
|
|
|
|
+ continue; //如果key不在监理表keysAll中,就跳过
|
|
|
|
+ }
|
|
|
|
+ keys.add(key);
|
|
|
|
+ String data = vo.getData();
|
|
|
|
+ values.add(data);
|
|
|
|
+ }
|
|
|
|
+ if (keys.size() > 0 && values.size() > 0 && keys.size() == values.size()) {
|
|
|
|
+ //delete SQL(删除旧数据,去重)
|
|
|
|
+ String delSql = "delete from " + initTabName + " where p_key_id = " + tabPKeyId + ";";
|
|
|
|
+ //insert SQL(新增)
|
|
|
|
+ dataSql.append(delSql).append("insert into ")
|
|
|
|
+ .append(initTabName).append(" (id,p_key_id,group_id,")
|
|
|
|
+ .append(String.join(",", keys))
|
|
|
|
+ .append(") values (")
|
|
|
|
+ .append(SnowFlakeUtil.getId()).append(",")
|
|
|
|
+ .append(tabPKeyId).append(",null,")
|
|
|
|
+ .append(values.stream()
|
|
|
|
+ .map(s -> "'" + s + "'")
|
|
|
|
+ .collect(Collectors.joining(",")))
|
|
|
|
+ .append(");");
|
|
|
|
+
|
|
|
|
+ resultSQLS.add(dataSql.toString());
|
|
}
|
|
}
|
|
- keys.add(key);
|
|
|
|
- String data = vo.getData();
|
|
|
|
- values.add(data);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (keys.size() > 0 && values.size() > 0 && keys.size() == values.size()) {
|
|
|
|
- //delete SQL(删除旧数据,去重)
|
|
|
|
- String delSql = "delete from " + initTabName + " where p_key_id = " + pKeyIdJL + ";";
|
|
|
|
- //insert SQL(新增)
|
|
|
|
- dataSql.append(delSql).append("insert into ")
|
|
|
|
- .append(initTabName).append(" (id,p_key_id,group_id,")
|
|
|
|
- .append(String.join(",", keys))
|
|
|
|
- .append(") values (")
|
|
|
|
- .append(SnowFlakeUtil.getId()).append(",")
|
|
|
|
- .append(pKeyIdJL).append(",null,")
|
|
|
|
- .append(values.stream()
|
|
|
|
- .map(s -> "'" + s + "'")
|
|
|
|
- .collect(Collectors.joining(",")))
|
|
|
|
- .append(");");
|
|
|
|
-
|
|
|
|
- resultAddData.add(dataSql.toString());
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//入库
|
|
//入库
|
|
- if (resultAddData.size() > 0) {
|
|
|
|
- List<List<String>> partition = Lists.partition(resultAddData, 10);
|
|
|
|
|
|
+ if (resultSQLS.size() > 0) {
|
|
|
|
+ List<List<String>> partition = Lists.partition(resultSQLS, 10);
|
|
for (List<String> strings : partition) {
|
|
for (List<String> strings : partition) {
|
|
jdbcTemplate.execute(StringUtils.join(strings, " "));
|
|
jdbcTemplate.execute(StringUtils.join(strings, " "));
|
|
}
|
|
}
|
|
@@ -759,7 +758,9 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
* @param resultData
|
|
* @param resultData
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
- private void syncTabDataImpl(Map<String, String> sgData, Map<String, String> jlData, List<InsertDataVO> resultData) throws Exception {
|
|
|
|
|
|
+ private void syncTabDataImpl
|
|
|
|
+ (Map<String, String> sgData, Map<String, String> jlData, List<InsertDataVO> resultData) throws
|
|
|
|
+ Exception {
|
|
for (Map.Entry<String, String> sgTab : sgData.entrySet()) { //质检表
|
|
for (Map.Entry<String, String> sgTab : sgData.entrySet()) { //质检表
|
|
String[] split = sgTab.getKey().split("---");
|
|
String[] split = sgTab.getKey().split("---");
|
|
String nodeNameRe = split[0];
|
|
String nodeNameRe = split[0];
|
|
@@ -1074,7 +1075,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public WbsTreeContractVO4 importWbsContract(MultipartFile excelFile, String primaryKeyId, Integer isSplicingNumber) throws IOException {
|
|
|
|
|
|
+ public WbsTreeContractVO4 importWbsContract(MultipartFile excelFile, String primaryKeyId, Integer
|
|
|
|
+ isSplicingNumber) throws IOException {
|
|
File file = FileUtils.convert(excelFile);
|
|
File file = FileUtils.convert(excelFile);
|
|
String canonicalPath = file.getCanonicalPath();
|
|
String canonicalPath = file.getCanonicalPath();
|
|
try {
|
|
try {
|
|
@@ -1097,7 +1099,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- private WbsTreeContractVO4 importSubmitWbsContractNodes(ArrayList<Map<String, String>> result, String primaryKeyId, Integer isSplicingNumber) {
|
|
|
|
|
|
+ private WbsTreeContractVO4 importSubmitWbsContractNodes(ArrayList<Map<String, String>> result, String
|
|
|
|
+ primaryKeyId, Integer isSplicingNumber) {
|
|
WbsTreeContract wbsTreeContractRoot = baseMapper.selectOne(Wrappers.<WbsTreeContract>query().lambda().eq(WbsTreeContract::getPKeyId, primaryKeyId));
|
|
WbsTreeContract wbsTreeContractRoot = baseMapper.selectOne(Wrappers.<WbsTreeContract>query().lambda().eq(WbsTreeContract::getPKeyId, primaryKeyId));
|
|
//获取当前节点下所有子节点
|
|
//获取当前节点下所有子节点
|
|
List<WbsTreeContractVO> wbsTreeContractVOS = contractInfoMapper.tree4(wbsTreeContractRoot.getContractId(), String.valueOf(wbsTreeContractRoot.getId()));
|
|
List<WbsTreeContractVO> wbsTreeContractVOS = contractInfoMapper.tree4(wbsTreeContractRoot.getContractId(), String.valueOf(wbsTreeContractRoot.getId()));
|
|
@@ -1274,7 +1277,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
- private List<WbsTreeContractVO> buildFailDataTree(List<WbsTreeContractVO> failData, List<WbsTreeContractVO> successData, Long parentIdRoot) {
|
|
|
|
|
|
+ private List<WbsTreeContractVO> buildFailDataTree
|
|
|
|
+ (List<WbsTreeContractVO> failData, List<WbsTreeContractVO> successData, Long parentIdRoot) {
|
|
List<WbsTreeContractVO> resultData = new ArrayList<>();
|
|
List<WbsTreeContractVO> resultData = new ArrayList<>();
|
|
resultData.addAll(successData);
|
|
resultData.addAll(successData);
|
|
resultData.addAll(failData);
|
|
resultData.addAll(failData);
|
|
@@ -1333,7 +1337,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private List<Map<Integer, String>> getResultList(ArrayList<Map<String, String>> result, Integer isSplicingNumber) {
|
|
|
|
|
|
+ private List<Map<Integer, String>> getResultList(ArrayList<Map<String, String>> result, Integer
|
|
|
|
+ isSplicingNumber) {
|
|
List<Map<Integer, String>> resultList = new ArrayList<>();
|
|
List<Map<Integer, String>> resultList = new ArrayList<>();
|
|
String str = "\\s*|\r|\n|\t";
|
|
String str = "\\s*|\r|\n|\t";
|
|
for (Map<String, String> map : result) {
|
|
for (Map<String, String> map : result) {
|
|
@@ -1417,7 +1422,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
return resultList;
|
|
return resultList;
|
|
}
|
|
}
|
|
|
|
|
|
- private List<WbsTreeContract> findAllNodeList(String wbsTreeIds, String projectId, String contractId, String wbsId) {
|
|
|
|
|
|
+ private List<WbsTreeContract> findAllNodeList(String wbsTreeIds, String projectId, String contractId, String
|
|
|
|
+ wbsId) {
|
|
String[] ids = wbsTreeIds.split(",");
|
|
String[] ids = wbsTreeIds.split(",");
|
|
List<WbsTreeContract> list = new ArrayList<>();
|
|
List<WbsTreeContract> list = new ArrayList<>();
|
|
for (String id : ids) {
|
|
for (String id : ids) {
|