|
@@ -260,11 +260,17 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
|
|
|
wbsFormElementService.save(wbsFormElement);
|
|
|
|
|
|
- //新增实体字段
|
|
|
- baseMapper.alterTableFiled(initTableName,
|
|
|
- wbsFormElement.getEKey(),
|
|
|
- getInitTableFiledType(wbsFormElement.getEType()),
|
|
|
- wbsFormElement.getELength());
|
|
|
+ String eTypeFiled = getInitTableFiledType(wbsFormElement.getEType());
|
|
|
+ Integer eLengthFiled = wbsFormElement.getELength();
|
|
|
+
|
|
|
+ /*//新增实体字段
|
|
|
+ if (wbsFormElement.getEType() == 1 && wbsFormElement.getELength() > 255) {
|
|
|
+ //转为text类型
|
|
|
+ eTypeFiled = "text";
|
|
|
+ eLengthFiled = 0;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ baseMapper.alterTableFiled(initTableName, wbsFormElement.getEKey(), eTypeFiled, eLengthFiled);
|
|
|
}
|
|
|
|
|
|
});
|
|
@@ -351,7 +357,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
case "字符串":
|
|
|
case "签名":
|
|
|
case "文件":
|
|
|
- return 800;
|
|
|
+ return 255;
|
|
|
case "整数":
|
|
|
case "数值":
|
|
|
case "小数":
|
|
@@ -748,291 +754,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
return row > 0;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- @Deprecated
|
|
|
- public String submitWbsTreeInProject(WbsTreeContractDTO pawDTO) {
|
|
|
- String wbsTreeIds = pawDTO.getWbsTreeIds();
|
|
|
- String[] ids = wbsTreeIds.split(",");
|
|
|
- List<String> idList = Arrays.asList(ids);
|
|
|
- List<String> idList1 = idList.stream().filter(string -> !string.isEmpty()).collect(Collectors.toList());
|
|
|
- List<String> idList2 = new ArrayList<>();
|
|
|
-
|
|
|
- //当前公有引用
|
|
|
- if (pawDTO.getReferenceType().equals("public")) {
|
|
|
- List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
- .eq(WbsTreePrivate::getWbsId, pawDTO.getWbsId())
|
|
|
- .eq(WbsTreePrivate::getProjectId, pawDTO.getProjectId())
|
|
|
- .eq(WbsTreePrivate::getType, 1)
|
|
|
- );
|
|
|
- wbsTreePrivates.stream().forEach(wbsTreePrivate -> {
|
|
|
- idList2.add(String.valueOf(wbsTreePrivate.getId()));
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- //私有引用
|
|
|
- else if (pawDTO.getReferenceType().equals("private")) {
|
|
|
- List<WbsTreePrivate> wbsTreePrivates2 = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
- .eq(WbsTreePrivate::getWbsId, pawDTO.getPrimaryKeyId())
|
|
|
- .eq(WbsTreePrivate::getProjectId, pawDTO.getProjectId())
|
|
|
- .eq(WbsTreePrivate::getType, 1)
|
|
|
- );
|
|
|
- wbsTreePrivates2.stream().forEach(wbsTreePrivate -> {
|
|
|
- idList2.add(String.valueOf(wbsTreePrivate.getId()));
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- List<String> diffRent = WbsTreeContractServiceImpl.getDiffrent(idList1, idList2);
|
|
|
-
|
|
|
- //元素表同步
|
|
|
- if (diffRent.size() == 0) {
|
|
|
- if (pawDTO.getReferenceType().equals("public")) {
|
|
|
- //公有同步新增元素表
|
|
|
- //获取公有wbs树新增的元素表
|
|
|
- List<WbsTree> allNodeList = findAllNodeList(wbsTreeIds);
|
|
|
- List<WbsTree> wbsTreeListAll = new ArrayList<>();
|
|
|
-
|
|
|
- //获取公有wbs树所有的元素表
|
|
|
- if (allNodeList != null) {
|
|
|
- List<WbsTree> wbsTreeList = wbsTreeMapper.selectList(Wrappers.<WbsTree>query().lambda()
|
|
|
- .eq(WbsTree::getWbsId, pawDTO.getWbsId())
|
|
|
- .eq(WbsTree::getType, 2)
|
|
|
- );
|
|
|
- wbsTreeListAll.addAll(wbsTreeList);
|
|
|
- }
|
|
|
-
|
|
|
- //公有所以表的id
|
|
|
- List<Long> collect1 = wbsTreeListAll.stream().map(WbsTree::getId).collect(Collectors.toList());
|
|
|
- List<String> collect2 = collect1.stream().map(String::valueOf).collect(Collectors.toList());
|
|
|
-
|
|
|
- //获取项目私有wbs树下当前所有的元素表
|
|
|
- List<WbsTreePrivate> wbsTreePrivates1 = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
- .eq(WbsTreePrivate::getWbsId, pawDTO.getWbsId())
|
|
|
- .eq(WbsTreePrivate::getProjectId, pawDTO.getProjectId())
|
|
|
- .eq(WbsTreePrivate::getType, 2)
|
|
|
- );
|
|
|
-
|
|
|
- //私有下元素表id
|
|
|
- List<Long> collect3 = wbsTreePrivates1.stream().map(WbsTreePrivate::getId).collect(Collectors.toList());
|
|
|
- List<String> collect4 = collect3.stream().map(String::valueOf).collect(Collectors.toList());
|
|
|
-
|
|
|
- List<String> diffRent1 = WbsTreeContractServiceImpl.getDiffrent(collect2, collect4);
|
|
|
-
|
|
|
- if (diffRent1.size() == 0) {
|
|
|
- //当wbsTreeIds == "" 时 1.在第一次新增未选择wbs树时 2.同步新增的元素表时
|
|
|
- throw new ServiceException("请选择需要关联的树或未检测到所对应新增的元素表");
|
|
|
-
|
|
|
- } else {
|
|
|
- if (collect2.size() > collect4.size()) {
|
|
|
- //公有同步元素表
|
|
|
- diffRent1.stream().forEach(tableId -> {
|
|
|
- WbsTree wbsTree = wbsTreeMapper.selectById(tableId);
|
|
|
- Long snowId1 = SnowFlakeUtil.getId();
|
|
|
- wbsTreePrivateMapper.insertCombination1(snowId1, wbsTree, pawDTO.getWbsType(), pawDTO.getProjectId());
|
|
|
- });
|
|
|
-
|
|
|
- return "1";
|
|
|
- }
|
|
|
-
|
|
|
- //TODO删除
|
|
|
- }
|
|
|
-
|
|
|
- } else if (pawDTO.getReferenceType().equals("private")) {
|
|
|
- //私有同步新增元素表
|
|
|
- //获取所私有引用项目的新增的元素表 根据primaryKeyId获取对象信息
|
|
|
- WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
- .eq(WbsTreePrivate::getPKeyId, pawDTO.getPrimaryKeyId()));
|
|
|
-
|
|
|
- //获取所私有引用项目的wbs树的全部元素表
|
|
|
- List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
- .eq(WbsTreePrivate::getWbsId, wbsTreePrivate.getWbsId())
|
|
|
- .eq(WbsTreePrivate::getProjectId, wbsTreePrivate.getProjectId())
|
|
|
- .eq(WbsTreePrivate::getType, 2)
|
|
|
- );
|
|
|
-
|
|
|
- //当前新增表单的id
|
|
|
- List<Long> collect1 = wbsTreePrivates.stream().map(WbsTreePrivate::getId).collect(Collectors.toList());
|
|
|
- List<String> collect2 = collect1.stream().map(String::valueOf).collect(Collectors.toList());
|
|
|
-
|
|
|
- //获取当前项目私有wbs树下当前所有的元素表
|
|
|
- List<WbsTreePrivate> wbsTreePrivates1 = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
- .eq(WbsTreePrivate::getWbsId, pawDTO.getPrimaryKeyId())
|
|
|
- .eq(WbsTreePrivate::getProjectId, pawDTO.getProjectId())
|
|
|
- .eq(WbsTreePrivate::getType, 2)
|
|
|
- );
|
|
|
-
|
|
|
- //当前存在的表单的id
|
|
|
- List<Long> collect3 = wbsTreePrivates1.stream().map(WbsTreePrivate::getId).collect(Collectors.toList());
|
|
|
- List<String> collect4 = collect3.stream().map(String::valueOf).collect(Collectors.toList());
|
|
|
-
|
|
|
- List<String> diffRent1 = WbsTreeContractServiceImpl.getDiffrent(collect2, collect4);
|
|
|
-
|
|
|
- if (diffRent1.size() == 0) {
|
|
|
- throw new ServiceException("未检测到引用的私有wbs树下有新增的元素表");
|
|
|
-
|
|
|
- } else {
|
|
|
- if (collect2.size() > collect4.size()) {
|
|
|
- //私有同步元素表
|
|
|
- List<WbsTreePrivate> lists = new ArrayList<>();
|
|
|
-
|
|
|
- diffRent1.stream().forEach(tableId -> {
|
|
|
- List<WbsTreePrivate> wbsTreePrivates3 = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
- .eq(WbsTreePrivate::getId, tableId)
|
|
|
- .eq(WbsTreePrivate::getWbsId, wbsTreePrivate.getWbsId())
|
|
|
- .eq(WbsTreePrivate::getProjectId, wbsTreePrivate.getProjectId())
|
|
|
- .eq(WbsTreePrivate::getType, 2)
|
|
|
- );
|
|
|
- lists.addAll(wbsTreePrivates3);
|
|
|
- });
|
|
|
-
|
|
|
- lists.stream().forEach(list -> {
|
|
|
- list.setPKeyId(SnowFlakeUtil.getId());
|
|
|
- list.setWbsId(pawDTO.getPrimaryKeyId());
|
|
|
- list.setProjectId(pawDTO.getProjectId());
|
|
|
- });
|
|
|
-
|
|
|
- wbsTreePrivateService.saveBatch(lists, 10000);
|
|
|
- return "1";
|
|
|
- }
|
|
|
-
|
|
|
- //TODO删除
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //新增
|
|
|
- else {
|
|
|
- if (idList1.size() > idList2.size()) {
|
|
|
-
|
|
|
- //数据初始化节点-引用公有
|
|
|
- List<WbsTreePrivate> insertData = new ArrayList<>();
|
|
|
- //数据初始化节点-引用私有
|
|
|
- List<WbsTreePrivate> insertData2 = new ArrayList<>();
|
|
|
-
|
|
|
- if (pawDTO.getReferenceType().equals("public")) {
|
|
|
- //引用公有
|
|
|
- //查询所有公共节点+表 diffRent=新增的节点id
|
|
|
- List<WbsTree> addListData = new ArrayList<>();
|
|
|
- //查询出当前wbs树下所有节点+表信息
|
|
|
- List<WbsTree> treesAll = baseMapper.selectList(Wrappers.<WbsTree>query().lambda()
|
|
|
- .eq(WbsTree::getWbsId, pawDTO.getWbsId()));
|
|
|
-
|
|
|
- for (WbsTree wbsTree : treesAll) {
|
|
|
- for (String id : diffRent) {
|
|
|
- if (Long.parseLong(id) == (wbsTree.getId())) {
|
|
|
- //节点
|
|
|
- addListData.add(wbsTree);
|
|
|
- } else if (Long.parseLong(id) == (wbsTree.getParentId()) && wbsTree.getType() == 2) {
|
|
|
- //表
|
|
|
- addListData.add(wbsTree);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- addListData.stream().forEach(tree -> {
|
|
|
- WbsTreePrivate wbsTreePrivate2 = getWbsTreePrivate1(tree, pawDTO);
|
|
|
- insertData.add(wbsTreePrivate2);
|
|
|
- });
|
|
|
-
|
|
|
- } else if (pawDTO.getReferenceType().equals("private")) {
|
|
|
- //引用私有
|
|
|
- //查询所有私有节点+表 diffRent=新增的节点id
|
|
|
- List<WbsTreePrivate> addListData = new ArrayList<>();
|
|
|
-
|
|
|
- //查询出当前wbs树下所有节点+表信息
|
|
|
- List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectNodeAndTable(null, pawDTO.getWbsId(), pawDTO.getReferencePrivateWbsProjectId());
|
|
|
-
|
|
|
- for (WbsTreePrivate wbsTreePrivate : wbsTreePrivates) {
|
|
|
- for (String id : diffRent) {
|
|
|
- if (Long.parseLong(id) == (wbsTreePrivate.getId())) {
|
|
|
- //节点
|
|
|
- addListData.add(wbsTreePrivate);
|
|
|
- } else if (Long.parseLong(id) == (wbsTreePrivate.getParentId()) && wbsTreePrivate.getType() == 2) {
|
|
|
- //表
|
|
|
- addListData.add(wbsTreePrivate);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- addListData.stream().forEach(tree -> {
|
|
|
-
|
|
|
- WbsTreePrivate wbsTreePrivate2 = getWbsTreePrivate2(tree, pawDTO);
|
|
|
- insertData2.add(wbsTreePrivate2);
|
|
|
-
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- if (pawDTO.getReferenceType().equals("public")) {
|
|
|
- wbsTreePrivateService.saveBatch(insertData, 10000);
|
|
|
- projectInfoMapper.updateTemplateIdById(pawDTO.getProjectId(), pawDTO.getWbsId(), "public");
|
|
|
- } else if (pawDTO.getReferenceType().equals("private")) {
|
|
|
- wbsTreePrivateService.saveBatch(insertData2, 10000);
|
|
|
- projectInfoMapper.updateTemplateIdById(pawDTO.getProjectId(), pawDTO.getPrimaryKeyId(), "private");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- //删除节点 表单
|
|
|
- else {
|
|
|
- if (pawDTO.getReferenceType().equals("public")) {
|
|
|
- List<Long> ids1 = diffRent.stream().map(Long::parseLong).collect(Collectors.toList());
|
|
|
- //判断是否被合同段引用
|
|
|
- List<WbsTreeContract> wbsTreeContract = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
- .eq(WbsTreeContract::getWbsId, pawDTO.getWbsId())
|
|
|
- .eq(WbsTreeContract::getProjectId, pawDTO.getProjectId())
|
|
|
- .eq(WbsTreeContract::getParentId, 0)
|
|
|
- );
|
|
|
-
|
|
|
- if (wbsTreeContract.size() > 0) {
|
|
|
- List<ContractInfo> contractInfoArrayList = new ArrayList<>();
|
|
|
- wbsTreeContract.stream().forEach(list -> {
|
|
|
- ContractInfo contractInfos = contractInfoMapper.selectOne(Wrappers.<ContractInfo>query().lambda()
|
|
|
- .eq(ContractInfo::getId, list.getContractId())
|
|
|
- );
|
|
|
- contractInfoArrayList.add(contractInfos);
|
|
|
- });
|
|
|
- List<String> names = contractInfoArrayList.stream().map(ContractInfo::getContractName).collect(Collectors.toList());
|
|
|
- if (wbsTreeContract.size() > 0) {
|
|
|
- String join = StringUtils.join(names, ",");
|
|
|
- throw new ServiceException(StringUtil.format("当前项目wbs树已被合同段 {} 引用中,请先取消合同段关联后再删除", join));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- baseMapper.deleteBatch(ids1, pawDTO.getWbsId(), pawDTO.getProjectId());
|
|
|
- baseMapper.deleteBatch2(ids1, pawDTO.getWbsId(), pawDTO.getProjectId());
|
|
|
-
|
|
|
- } else if (pawDTO.getReferenceType().equals("private")) {
|
|
|
- List<Long> ids2 = diffRent.stream().map(Long::parseLong).collect(Collectors.toList());
|
|
|
- //判断是否被合同段引用
|
|
|
- List<WbsTreeContract> wbsTreeContract = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
- .eq(WbsTreeContract::getWbsId, pawDTO.getPrimaryKeyId())
|
|
|
- .eq(WbsTreeContract::getProjectId, pawDTO.getProjectId())
|
|
|
- .eq(WbsTreeContract::getParentId, 0)
|
|
|
- );
|
|
|
-
|
|
|
- if (wbsTreeContract.size() > 0) {
|
|
|
- List<ContractInfo> contractInfoArrayList = new ArrayList<>();
|
|
|
- wbsTreeContract.stream().forEach(list -> {
|
|
|
- ContractInfo contractInfos = contractInfoMapper.selectOne(Wrappers.<ContractInfo>query().lambda()
|
|
|
- .eq(ContractInfo::getId, list.getContractId())
|
|
|
- );
|
|
|
- contractInfoArrayList.add(contractInfos);
|
|
|
- });
|
|
|
- List<String> names = contractInfoArrayList.stream().map(ContractInfo::getContractName).collect(Collectors.toList());
|
|
|
- if (wbsTreeContract.size() > 0) {
|
|
|
- String join = StringUtils.join(names, ",");
|
|
|
- throw new ServiceException(StringUtil.format("当前项目wbs树已被合同段 {} 引用中,请先取消合同段关联后再删除", join));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- baseMapper.deleteBatch(ids2, pawDTO.getPrimaryKeyId(), pawDTO.getProjectId());
|
|
|
- baseMapper.deleteBatch2(ids2, pawDTO.getPrimaryKeyId(), pawDTO.getProjectId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return "2";
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean submitWbsTreeInProject1(WbsTreeContractDTO pawDTO) {
|
|
@@ -1275,7 +996,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
});
|