|
@@ -1622,27 +1622,45 @@ public class ExcelTabController extends BladeController {
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
|
|
|
List<WbsTreeContract> wbsTreeContractList = wbsTreeContractService.getBaseMapper().selectList(Wrappers.<WbsTreeContract>query().lambda()
|
|
List<WbsTreeContract> wbsTreeContractList = wbsTreeContractService.getBaseMapper().selectList(Wrappers.<WbsTreeContract>query().lambda()
|
|
- .eq(WbsTreeContract::getId, wbsInfo.getId())
|
|
|
|
|
|
+ .likeRight(WbsTreeContract::getNodeName,wbsInfo.getNodeName())
|
|
.eq(WbsTreeContract::getContractId, wbsInfo.getContractId())
|
|
.eq(WbsTreeContract::getContractId, wbsInfo.getContractId())
|
|
.eq(WbsTreeContract::getParentId, wbsInfo.getParentId()));
|
|
.eq(WbsTreeContract::getParentId, wbsInfo.getParentId()));
|
|
List<WbsTreeContract> wbsTreeContractList2 = wbsTreeContractList.stream().sorted(Comparator.comparing(WbsTreeContract::getCreateTime).reversed()).collect(Collectors.toList());
|
|
List<WbsTreeContract> wbsTreeContractList2 = wbsTreeContractList.stream().sorted(Comparator.comparing(WbsTreeContract::getCreateTime).reversed()).collect(Collectors.toList());
|
|
|
|
+ Set<String> strings = wbsTreeContractList2.stream().map(o -> o.getNodeName()).collect(Collectors.toSet());
|
|
|
|
+ List<WbsTreeContract>wbsTreeContractList3=wbsTreeContractList.stream().sorted(Comparator.comparing(WbsTreeContract::getCreateTime)).collect(Collectors.toList());
|
|
|
|
+ Boolean flag=false;
|
|
|
|
+ if(strings.size()!=wbsTreeContractList3.size()){
|
|
|
|
+ flag=true;
|
|
|
|
+ for (int i = 0; i < wbsTreeContractList3.size(); i++) {
|
|
|
|
+ if(wbsTreeContractList3.get(i).getIsCopeTab()!=null&&wbsTreeContractList3.get(i).getIsCopeTab().equals(Integer.valueOf(2))){
|
|
|
|
+ String nodeName=wbsTreeContractList3.get(0).getNodeName();
|
|
|
|
+ nodeName=nodeName+"__"+(i);
|
|
|
|
+ wbsTreeContractList3.get(i).setNodeName(nodeName);
|
|
|
|
+ String update="UPDATE m_wbs_tree_contract Set node_name= "+"'"+wbsTreeContractList3.get(i).getNodeName()+"'"+" WHERE p_key_id="+wbsTreeContractList3.get(i).getPKeyId();
|
|
|
|
+ jdbcTemplate.update(update);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //新增
|
|
long tabGroupId = SnowFlakeUtil.getId();
|
|
long tabGroupId = SnowFlakeUtil.getId();
|
|
-
|
|
|
|
long newPkId = SnowFlakeUtil.getId();
|
|
long newPkId = SnowFlakeUtil.getId();
|
|
WbsTreeContract wbsTreeContract = new WbsTreeContract();
|
|
WbsTreeContract wbsTreeContract = new WbsTreeContract();
|
|
BeanUtil.copy(wbsInfo, wbsTreeContract);
|
|
BeanUtil.copy(wbsInfo, wbsTreeContract);
|
|
wbsTreeContract.setPKeyId(newPkId);
|
|
wbsTreeContract.setPKeyId(newPkId);
|
|
wbsTreeContract.setCreateTime(new Date());
|
|
wbsTreeContract.setCreateTime(new Date());
|
|
wbsTreeContract.setTabGroupId(tabGroupId);
|
|
wbsTreeContract.setTabGroupId(tabGroupId);
|
|
- String nodeName = wbsTreeContractList2.get(0).getNodeName();
|
|
|
|
-
|
|
|
|
|
|
+ String nodeName;
|
|
|
|
+ if(flag){
|
|
|
|
+ nodeName=wbsTreeContractList3.get(wbsTreeContractList3.size()-1).getNodeName();
|
|
|
|
+ }else {
|
|
|
|
+ nodeName= wbsTreeContractList2.get(0).getNodeName();
|
|
|
|
+ }
|
|
if (nodeName.indexOf("__") >= 0) {
|
|
if (nodeName.indexOf("__") >= 0) {
|
|
String[] oldName = nodeName.split("__");
|
|
String[] oldName = nodeName.split("__");
|
|
nodeName = oldName[0] + "__" + (Integer.parseInt(oldName[1]) + 1);
|
|
nodeName = oldName[0] + "__" + (Integer.parseInt(oldName[1]) + 1);
|
|
} else {
|
|
} else {
|
|
nodeName = nodeName + "__" + 1;
|
|
nodeName = nodeName + "__" + 1;
|
|
}
|
|
}
|
|
- System.out.println("cr");
|
|
|
|
wbsTreeContract.setNodeName(nodeName);
|
|
wbsTreeContract.setNodeName(nodeName);
|
|
wbsTreeContract.setIsCopeTab(2);
|
|
wbsTreeContract.setIsCopeTab(2);
|
|
wbsTreeContract.setIsTabPdf(1); // pdf 不能预览
|
|
wbsTreeContract.setIsTabPdf(1); // pdf 不能预览
|