|
@@ -108,7 +108,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
}
|
|
|
|
|
|
private List<WbsTreeVO2> buildWbsTreeByStream(List<WbsTreeVO2> wbsTreeVO2s) {
|
|
|
- //构建数据,获取根节点
|
|
|
+ //构建数据
|
|
|
List<WbsTreeVO2> list = wbsTreeVO2s.stream().filter(f -> f.getParentId() == 0L).collect(Collectors.toList());
|
|
|
//根节点分组
|
|
|
Map<Long, List<WbsTreeVO2>> map = wbsTreeVO2s.stream().collect(Collectors.groupingBy(WbsTreeVO2::getParentId));
|
|
@@ -148,21 +148,21 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
}
|
|
|
wbsTree.setStatus(1);
|
|
|
wbsTree.setIsDeleted(BladeConstant.DB_NOT_DELETED);
|
|
|
- //新增节点默认排序
|
|
|
+
|
|
|
+ //新增默认排序
|
|
|
//获取当前同级节点List
|
|
|
if (wbsTree.getId() == null) {
|
|
|
List<WbsTree> trees = baseMapper.selectList(Wrappers.<WbsTree>query().lambda()
|
|
|
.eq(WbsTree::getParentId, wbsTree.getParentId())
|
|
|
.eq(WbsTree::getType, 1)
|
|
|
);
|
|
|
- //判空
|
|
|
List<WbsTree> collect = trees.stream().filter(f -> {
|
|
|
if (f.getSort() == null) {
|
|
|
f.setSort(0);
|
|
|
}
|
|
|
return true;
|
|
|
}).collect(Collectors.toList());
|
|
|
- //获取最大Sort
|
|
|
+ //获取最大sort
|
|
|
Optional<WbsTree> max = collect.stream().max(Comparator.comparingInt(WbsTree::getSort));
|
|
|
Integer sort = 0;
|
|
|
if (max.isPresent()) {
|
|
@@ -170,6 +170,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
}
|
|
|
wbsTree.setSort(sort + 1);
|
|
|
}
|
|
|
+
|
|
|
return saveOrUpdate(wbsTree);
|
|
|
}
|
|
|
|
|
@@ -187,18 +188,17 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
fd.setTenantId(parent.getTenantId());
|
|
|
String ancestors = parent.getAncestors() + StringPool.COMMA + fd.getParentId();
|
|
|
fd.setAncestors(ancestors);
|
|
|
- //设置表示该父节点下存在表单
|
|
|
baseMapper.updateIsExistFormById(parent.getId());
|
|
|
}
|
|
|
- //设置类型默认值为 '2' 表单
|
|
|
fd.setType(2);
|
|
|
fd.setIsDeleted(BladeConstant.DB_NOT_DELETED);
|
|
|
+
|
|
|
return saveOrUpdate(fd);
|
|
|
}
|
|
|
|
|
|
public boolean submit3(WbsTree wbsTree) {
|
|
|
if (wbsTree.getParentId() > 0) {
|
|
|
- //设置表示该父节点下存在表单
|
|
|
+
|
|
|
baseMapper.updateIsExistFormById(wbsTree.getParentId());
|
|
|
}
|
|
|
return save(wbsTree);
|
|
@@ -213,7 +213,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
public boolean importWbsTreeTableAndForm(MultipartFile excelFile, WbsTree wbsTree) {
|
|
|
String canonicalPath = null;
|
|
|
try {
|
|
|
- //解析
|
|
|
+ //解析excel
|
|
|
File file = WbsExcelBatchUtil.convert(excelFile);
|
|
|
canonicalPath = file.getCanonicalPath();
|
|
|
WbsExcelBatchUtil excelUtil = new WbsExcelBatchUtil();
|
|
@@ -222,6 +222,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
List<Map<String, String>> maps = WbsExcelBatchUtil.removeRepeatMapByKey(result, "表名");
|
|
|
assert maps != null;
|
|
|
List<WbsTreeBatchImportDTO> list = new ArrayList<>();
|
|
|
+
|
|
|
//初始化
|
|
|
wbsTree.setTenantId(wbsTree.getTenantId());
|
|
|
wbsTree.setDeptCategory(1);
|
|
@@ -232,6 +233,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
wbsTree.setType(2);
|
|
|
wbsTree.setIsDeleted(BladeConstant.DB_NOT_DELETED);
|
|
|
wbsTree.setStatus(1);
|
|
|
+
|
|
|
maps.stream().forEach(map -> {
|
|
|
String deptName = map.get("表名");
|
|
|
wbsTree.setDeptName(deptName);
|
|
@@ -240,25 +242,30 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
String initTableName = "m_wbs_form_" + DateUtil.time() + "_" + id.toString();
|
|
|
wbsTree.setInitTableName(initTableName);
|
|
|
wbsTree.setId(id);
|
|
|
+
|
|
|
//新增表单
|
|
|
boolean b = submit3(wbsTree);
|
|
|
+
|
|
|
if (b) {
|
|
|
//新增实体表
|
|
|
initTable(initTableName);
|
|
|
- //返参
|
|
|
+
|
|
|
WbsTreeBatchImportDTO wbsTreeBatchImportDTO = new WbsTreeBatchImportDTO();
|
|
|
wbsTreeBatchImportDTO.setId(id);
|
|
|
wbsTreeBatchImportDTO.setTableName(deptName);
|
|
|
wbsTreeBatchImportDTO.setInitTableName(initTableName);
|
|
|
list.add(wbsTreeBatchImportDTO);
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
//新增元素
|
|
|
list.stream().forEach(i -> {
|
|
|
Long elementTableId = i.getId();
|
|
|
String tableName = i.getTableName();
|
|
|
String initTableName = i.getInitTableName();
|
|
|
final int[] keyNumb = {0};
|
|
|
+
|
|
|
result2.stream().forEach(map -> {
|
|
|
if (tableName.equals(map.get("表名"))) {
|
|
|
keyNumb[0]++;
|
|
@@ -272,16 +279,20 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
wbsFormElement.setEInspectionMethod(map.get("计算公式、方法或数值"));
|
|
|
wbsFormElement.setEAllowDeviation(map.get("允许偏差范围"));
|
|
|
wbsFormElement.setRemark(map.get("备注"));
|
|
|
+
|
|
|
wbsFormElementService.save(wbsFormElement);
|
|
|
+
|
|
|
//新增实体字段
|
|
|
baseMapper.alterTableFiled(initTableName,
|
|
|
wbsFormElement.getEKey(),
|
|
|
getInitTableFiledType(wbsFormElement.getEType()),
|
|
|
wbsFormElement.getELength());
|
|
|
}
|
|
|
+
|
|
|
});
|
|
|
});
|
|
|
return true;
|
|
|
+
|
|
|
} catch (
|
|
|
IOException | ClassNotFoundException e) {
|
|
|
throw new ServiceException("操作失败,请上传正确模板内容");
|
|
@@ -302,7 +313,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
|
|
|
|
|
|
private Boolean initTable(String tableName) {
|
|
|
- //建表
|
|
|
Integer row = baseMapper.createTable(tableName);
|
|
|
if (row >= 0) {
|
|
|
return true;
|
|
@@ -313,20 +323,27 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
private String getInitTableFiledType(Integer type) {
|
|
|
switch (type) {
|
|
|
case 2:
|
|
|
- return "bigint"; //整数
|
|
|
+ //整数
|
|
|
+ return "bigint";
|
|
|
case 3:
|
|
|
- return "decimal"; //小数
|
|
|
+ //小数
|
|
|
+ return "decimal";
|
|
|
case 4:
|
|
|
- return "datetime"; //日期
|
|
|
+ //日期
|
|
|
+ return "datetime";
|
|
|
case 5:
|
|
|
- return "decimal"; //数值
|
|
|
+ //数值
|
|
|
+ return "decimal";
|
|
|
case 6:
|
|
|
- return "varchar"; //签名
|
|
|
+ //签名
|
|
|
+ return "varchar";
|
|
|
case 7:
|
|
|
- return "varchar"; //文件
|
|
|
+ //文件
|
|
|
+ return "varchar";
|
|
|
case 1:
|
|
|
default:
|
|
|
- return "varchar"; //字符串
|
|
|
+ //字符串
|
|
|
+ return "varchar";
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -396,16 +413,12 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
|
|
|
@Override
|
|
|
public List<WbsNodeTableVO> selectByNodeTable(String id) {
|
|
|
- //查询节点下的所有表单
|
|
|
- List<WbsNodeTableVO> wbsNodeTableVOS = wbsTreeMapper.selectByNodeTable(id);
|
|
|
- return wbsNodeTableVOS;
|
|
|
+ return wbsTreeMapper.selectByNodeTable(id);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<WbsNodeTableVO> selectByNodeTableByExcel(String id, String projectid) {
|
|
|
- //查询节点下的所有表单
|
|
|
- List<WbsNodeTableVO> wbsNodeTableVOS = wbsTreeMapper.selectByNodeTableByExcel(id, projectid);
|
|
|
- return wbsNodeTableVOS;
|
|
|
+ return wbsTreeMapper.selectByNodeTableByExcel(id, projectid);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -450,7 +463,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
WbsTree wbsTree = wbsTreeMapper.selectOne(queryWrapper);
|
|
|
if (!("").equals(wbsTree) && wbsTree != null) {
|
|
|
return "-1";
|
|
|
-
|
|
|
}
|
|
|
assert wbsTree != null;
|
|
|
return String.valueOf(wbsTree.getId());
|
|
@@ -490,7 +502,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
}
|
|
|
|
|
|
private boolean importExcel(ArrayList<Map<String, String>> result, WbsTree wbsTreeFu, WbsTree wbsTree1) {
|
|
|
- //解析list-map
|
|
|
+ //解析
|
|
|
result.stream().forEach(map -> {
|
|
|
map.forEach((nodeType, nodeName) -> {
|
|
|
if (StringUtils.isNotEmpty(nodeName)) {
|
|
@@ -587,7 +599,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
//采用批量 默认排序
|
|
|
private boolean importExcel2(ArrayList<Map<String, String>> result, WbsTree wbsTreeFu, WbsTree wbsTree1) {
|
|
|
List<WbsTree> allNodeData = new ArrayList<>();
|
|
|
- //解析list-map
|
|
|
+ //解析
|
|
|
for (Map<String, String> map : result) {
|
|
|
for (Map.Entry<String, String> maps : map.entrySet()) {
|
|
|
if (StringUtils.isNotEmpty(maps.getValue())) {
|
|
@@ -736,8 +748,8 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
|
|
|
@Override
|
|
|
public List<WbsTreeDTO2> findWbsTreeSameLevel(String parentId) {
|
|
|
- List<WbsTreeDTO2> trees = baseMapper.selectWbsTreeListByParentId(parentId);
|
|
|
- return trees;
|
|
|
+
|
|
|
+ return baseMapper.selectWbsTreeListByParentId(parentId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -766,10 +778,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
|
|
|
private boolean updateData(String ancestors, Long id) {
|
|
|
Integer row = baseMapper.updateById2(ancestors, id);
|
|
|
- if (row > 0) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
+ return row > 0;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -784,6 +793,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
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()
|
|
@@ -795,6 +805,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
idList2.add(String.valueOf(wbsTreePrivate.getId()));
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
//私有引用
|
|
|
else if (pawDTO.getReferenceType().equals("private")) {
|
|
|
List<WbsTreePrivate> wbsTreePrivates2 = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
|
|
@@ -806,7 +817,9 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
idList2.add(String.valueOf(wbsTreePrivate.getId()));
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
List<String> diffRent = WbsTreeContractServiceImpl.getDiffrent(idList1, idList2);
|
|
|
+
|
|
|
//元素表同步
|
|
|
if (diffRent.size() == 0) {
|
|
|
if (pawDTO.getReferenceType().equals("public")) {
|
|
@@ -824,20 +837,25 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
wbsTreeListAll.addAll(wbsTreeList);
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
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)
|
|
|
);
|
|
|
+
|
|
|
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()) {
|
|
|
//公有同步元素表
|
|
@@ -846,38 +864,48 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
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)
|
|
|
);
|
|
|
+
|
|
|
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)
|
|
|
);
|
|
|
+
|
|
|
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)
|
|
@@ -887,15 +915,19 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
);
|
|
|
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删除
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -910,7 +942,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
|
|
|
if (pawDTO.getReferenceType().equals("public")) {
|
|
|
//引用公有
|
|
|
-
|
|
|
//查询所有公共节点+表 diffRent=新增的节点id
|
|
|
List<List<WbsTree>> addListData = new ArrayList<>();
|
|
|
|
|
@@ -930,7 +961,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
|
|
|
} else if (pawDTO.getReferenceType().equals("private")) {
|
|
|
//引用私有
|
|
|
-
|
|
|
//查询所有私有节点+表 diffRent=新增的节点id
|
|
|
List<List<WbsTreePrivate>> addListData = new ArrayList<>();
|
|
|
|
|
@@ -1103,12 +1133,14 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
@Override
|
|
|
public WbsTreeAllListVO findWbsTreeList(Integer type) {
|
|
|
WbsTreeAllListVO wbsTreeAllListVO = new WbsTreeAllListVO();
|
|
|
- //Wbs总树
|
|
|
+ //公有树
|
|
|
List<WbsInfo> wbsInfos = wbsInfoMapper.selectAll(type);
|
|
|
wbsTreeAllListVO.setWbsInfos(wbsInfos);
|
|
|
- //项目私有树
|
|
|
+
|
|
|
+ //私有树
|
|
|
List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectAll(type);
|
|
|
wbsTreeAllListVO.setWbsTreePrivates(wbsTreePrivates);
|
|
|
+
|
|
|
return wbsTreeAllListVO;
|
|
|
}
|
|
|
|
|
@@ -1118,6 +1150,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
if (formElementDTO.getElementList().size() <= 0) {
|
|
|
return R.fail("操作失败,请先添加表单元素");
|
|
|
}
|
|
|
+
|
|
|
String filedName = "";
|
|
|
String filedType = "";
|
|
|
String filedLength = "";
|
|
@@ -1126,6 +1159,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
filedType = String.valueOf(wbsFormElement.getEType());
|
|
|
filedLength = String.valueOf(wbsFormElement.getELength());
|
|
|
}
|
|
|
+
|
|
|
if (StringUtils.isEmpty(filedName) || StringUtils.isEmpty(filedType) || StringUtils.isEmpty(filedLength)) {
|
|
|
return R.fail("操作失败,请完整填写元素参数");
|
|
|
}
|
|
@@ -1133,15 +1167,18 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
if (deptName.length() > 100 || deptName.length() < 1) {
|
|
|
throw new ServiceException("表名长度错误,输入范围1-100个字符长度");
|
|
|
}
|
|
|
+
|
|
|
//初始化表名
|
|
|
//String realName = getFirstSpell(deptName);
|
|
|
Long id = SnowFlakeUtil.getId();
|
|
|
String newTableName = "m_wbs_form_" + DateUtil.time() + "_" + id.toString();
|
|
|
formElementDTO.setInitTableName(newTableName);
|
|
|
+
|
|
|
//创建元素表
|
|
|
boolean b1 = submit2(formElementDTO);
|
|
|
List<WbsFormElement> elementList = formElementDTO.getElementList();
|
|
|
int i = 1;
|
|
|
+
|
|
|
for (WbsFormElement wbsFormElement : elementList) {
|
|
|
if (wbsFormElement.getEType() == 1 && (wbsFormElement.getELength() > 1000 || wbsFormElement.getELength() < 10)) {
|
|
|
throw new ServiceException("请输入正确的字符串长度,范围为10-1000");
|
|
@@ -1152,21 +1189,27 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
if (wbsFormElement.getEType() == 3 && (wbsFormElement.getELength() > 65 || wbsFormElement.getELength() < 10)) {
|
|
|
throw new ServiceException("请输入正确的小数长度,范围为10-65");
|
|
|
}
|
|
|
+
|
|
|
//当前元素表中元素对应实体表唯一key值、fId
|
|
|
wbsFormElement.setEKey("key_" + i++);
|
|
|
wbsFormElement.setFId(String.valueOf(formElementDTO.getId()));
|
|
|
}
|
|
|
+
|
|
|
//新增元素
|
|
|
boolean b2 = wbsFormElementService.saveBatch(elementList);
|
|
|
+
|
|
|
//找到当前元素表中所有元素
|
|
|
List<WbsFormElement> list = wbsFormElementService.selectElementListByFid(String.valueOf(formElementDTO.getId()));
|
|
|
+
|
|
|
//初始化实体表
|
|
|
Boolean b3 = wbsFormElementService.initTable(list, newTableName);
|
|
|
+
|
|
|
if (b1 && b2 && b3) {
|
|
|
return R.data(formElementDTO, "新增表单、元素、初始化实体表成功");
|
|
|
} else {
|
|
|
throw new ServiceException("操作失败");
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public static String getFirstSpell(String chinese) {
|
|
@@ -1196,10 +1239,13 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
//text 文本, separator 转换后添加的分隔符
|
|
|
char[] chars = text.toCharArray();
|
|
|
HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
|
|
|
+
|
|
|
// 设置大小写
|
|
|
format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
|
|
|
+
|
|
|
// 设置声调表示方法
|
|
|
format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
|
|
|
+
|
|
|
// 设置字母u表示方法
|
|
|
format.setVCharType(HanyuPinyinVCharType.WITH_V);
|
|
|
String[] s;
|
|
@@ -1215,11 +1261,14 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
sb.append(chars[i]);
|
|
|
+
|
|
|
if ((i + 1 >= chars.length) || String.valueOf(chars[i + 1]).matches("[\\u4E00-\\u9FA5]+")) {
|
|
|
sb.append(separator);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
rs = sb.substring(0, sb.length());
|
|
|
} catch (BadHanyuPinyinOutputFormatCombination e) {
|
|
|
e.printStackTrace();
|
|
@@ -1228,7 +1277,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
}
|
|
|
|
|
|
public int updateByCondition(Long id, String wbsName, Integer status) {
|
|
|
- int row = baseMapper.updateByCondition(id, wbsName, status);
|
|
|
- return row;
|
|
|
+ return baseMapper.updateByCondition(id, wbsName, status);
|
|
|
}
|
|
|
}
|