Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
24237821
提交
24237821
编写于
1月 05, 2021
作者:
tangyaolong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【dst模型初始化导入导出】修改细节
上级
2fc4f0e7
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
31 行增加
和
70 行删除
+31
-70
MetaModelExService.java
...n/ibizlab/core/extensions/service/MetaModelExService.java
+2
-2
LiteModelService.java
...bizlab/core/lite/extensions/service/LiteModelService.java
+29
-68
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/MetaModelExService.java
浏览文件 @
24237821
...
@@ -313,8 +313,8 @@ public class MetaModelExService extends MetaModelServiceImpl {
...
@@ -313,8 +313,8 @@ public class MetaModelExService extends MetaModelServiceImpl {
*/
*/
protected
String
getFileName
(
String
fileName
)
{
protected
String
getFileName
(
String
fileName
)
{
try
{
try
{
//防止中文乱码
//
防止中文乱码
return
new
String
(
fileName
.
getBytes
(
"utf-8"
),
"iso8859-1"
);
return
new
String
(
fileName
.
getBytes
(
StandardCharsets
.
UTF_8
),
"iso8859-1"
);
}
catch
(
UnsupportedEncodingException
e
)
{
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/lite/extensions/service/LiteModelService.java
浏览文件 @
24237821
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
service
;
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
service
;
import
cn.ibizlab.core.extensions.domain.AssembleModel
;
import
cn.ibizlab.core.extensions.domain.AssembleModel
;
import
cn.ibizlab.core.extensions.service.MetaModelExService
;
import
cn.ibizlab.core.lite.domain.DstApp
;
import
cn.ibizlab.core.lite.domain.DstApp
;
import
cn.ibizlab.core.lite.domain.DstSystem
;
import
cn.ibizlab.core.lite.domain.DstSystem
;
import
cn.ibizlab.core.lite.domain.MetaEntity
;
import
cn.ibizlab.core.lite.domain.MetaEntity
;
...
@@ -14,10 +13,8 @@ import cn.ibizlab.core.lite.extensions.util.LiteStorage;
...
@@ -14,10 +13,8 @@ import cn.ibizlab.core.lite.extensions.util.LiteStorage;
import
cn.ibizlab.core.lite.filter.MetaFieldSearchContext
;
import
cn.ibizlab.core.lite.filter.MetaFieldSearchContext
;
import
cn.ibizlab.core.lite.service.*
;
import
cn.ibizlab.core.lite.service.*
;
import
cn.ibizlab.util.domain.FileItem
;
import
cn.ibizlab.util.domain.FileItem
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.errors.InternalServerErrorException
;
import
cn.ibizlab.util.errors.InternalServerErrorException
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -32,7 +29,10 @@ import org.springframework.util.StringUtils;
...
@@ -32,7 +29,10 @@ import org.springframework.util.StringUtils;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
import
java.io.*
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.util.*
;
import
java.util.*
;
...
@@ -63,11 +63,6 @@ public class LiteModelService {
...
@@ -63,11 +63,6 @@ public class LiteModelService {
@Lazy
@Lazy
private
IMetaRelationshipService
metaRelationshipService
;
private
IMetaRelationshipService
metaRelationshipService
;
@Autowired
@Lazy
private
IDstDataSourceService
dstDataSourceService
;
@Autowired
@Autowired
@Lazy
@Lazy
private
IMetaDataSetService
metaDataSetService
;
private
IMetaDataSetService
metaDataSetService
;
...
@@ -99,28 +94,30 @@ public class LiteModelService {
...
@@ -99,28 +94,30 @@ public class LiteModelService {
EntityModel
entityModel
=
new
EntityModel
();
EntityModel
entityModel
=
new
EntityModel
();
entityModel
.
setEntity
(
entity
);
entityModel
.
setEntity
(
entity
);
entityModel
.
setDataSets
(
metaDataSetService
.
selectByEntityId
(
entity
!=
null
?
entity
.
getEntityId
()
:
null
));
Map
<
String
,
RelationshipModel
>
parentSet
=
new
LinkedHashMap
();
Map
<
String
,
RelationshipModel
>
parentSet
=
new
LinkedHashMap
();
List
<
RelationshipModel
>
references
=
new
ArrayList
<>();
List
<
RelationshipModel
>
references
=
new
ArrayList
<>();
metaRelationshipService
.
selectByEntityId
(
entity
.
getEntityId
()).
forEach
(
item
->
if
(
entity
!=
null
)
{
{
entityModel
.
setDataSets
(
metaDataSetService
.
selectByEntityId
(
entity
.
getEntityId
()));
RelationshipModel
model
=
new
RelationshipModel
();
metaRelationshipService
.
selectByEntityId
(
entity
.
getEntityId
()).
forEach
(
item
->
MetaEntity
parentEntity
=
LiteStorage
.
getMetaEntity
(
item
.
getRefEntityId
());
{
if
(
parentEntity
!=
null
){
RelationshipModel
model
=
new
RelationshipModel
();
model
.
setRelation
(
item
);
MetaEntity
parentEntity
=
LiteStorage
.
getMetaEntity
(
item
.
getRefEntityId
());
model
.
setCodeName
(
item
.
getCodeName
());
if
(
parentEntity
!=
null
){
model
.
setDataSourceName
(
parentEntity
.
getDsName
());
model
.
setRelation
(
item
);
model
.
setEntityCodeName
(
parentEntity
.
getCodeName
());
model
.
setCodeName
(
item
.
getCodeName
());
model
.
setEntityId
(
parentEntity
.
getEntityId
());
model
.
setDataSourceName
(
parentEntity
.
getDsName
());
model
.
setEntityLogicName
(
parentEntity
.
getLogicName
());
model
.
setEntityCodeName
(
parentEntity
.
getCodeName
());
model
.
setEntityName
(
parentEntity
.
getEntityName
());
model
.
setEntityId
(
parentEntity
.
getEntityId
());
model
.
setSystemId
(
parentEntity
.
getSystemId
());
model
.
setEntityLogicName
(
parentEntity
.
getLogicName
());
model
.
setTableName
(
parentEntity
.
getTableName
());
model
.
setEntityName
(
parentEntity
.
getEntityName
());
parentSet
.
put
(
item
.
getId
(),
model
);
model
.
setSystemId
(
parentEntity
.
getSystemId
());
references
.
add
(
model
);
model
.
setTableName
(
parentEntity
.
getTableName
());
}
parentSet
.
put
(
item
.
getId
(),
model
);
});
references
.
add
(
model
);
}
});
}
entityModel
.
setReferences
(
references
);
entityModel
.
setReferences
(
references
);
List
<
RelationshipModel
>
nesteds
=
new
ArrayList
<>();
List
<
RelationshipModel
>
nesteds
=
new
ArrayList
<>();
...
@@ -176,9 +173,7 @@ public class LiteModelService {
...
@@ -176,9 +173,7 @@ public class LiteModelService {
public
void
initMetaEntity
()
public
void
initMetaEntity
()
{
{
metaEntityService
.
list
().
forEach
(
metaEntity
->
{
metaEntityService
.
list
().
forEach
(
LiteStorage:
:
putMetaEntity
);
LiteStorage
.
putMetaEntity
(
metaEntity
);
});
}
}
@Autowired
@Autowired
...
@@ -208,9 +203,6 @@ public class LiteModelService {
...
@@ -208,9 +203,6 @@ public class LiteModelService {
@Value
(
"${ibiz.filePath:/app/file/}"
)
@Value
(
"${ibiz.filePath:/app/file/}"
)
private
String
fileRoot
;
private
String
fileRoot
;
@Autowired
private
MetaModelExService
metaModelExService
;
@Cacheable
(
value
=
"syspssystem"
,
key
=
"'row:all-dst-apps'"
)
@Cacheable
(
value
=
"syspssystem"
,
key
=
"'row:all-dst-apps'"
)
public
LinkedHashMap
<
String
,
DstApp
>
getApps
()
{
public
LinkedHashMap
<
String
,
DstApp
>
getApps
()
{
LinkedHashMap
<
String
,
DstApp
>
appNode
=
new
LinkedHashMap
<>();
LinkedHashMap
<
String
,
DstApp
>
appNode
=
new
LinkedHashMap
<>();
...
@@ -224,9 +216,7 @@ public class LiteModelService {
...
@@ -224,9 +216,7 @@ public class LiteModelService {
system
.
setApps
(
system
.
getSysstructure
().
getSysApps
(
true
));
system
.
setApps
(
system
.
getSysstructure
().
getSysApps
(
true
));
dstSystemService
.
update
(
system
);
dstSystemService
.
update
(
system
);
}
}
system
.
getApps
().
forEach
(
app
->
{
system
.
getApps
().
forEach
(
app
->
appNode
.
put
(
app
.
getId
(),
app
));
appNode
.
put
(
app
.
getId
(),
app
);
});
});
});
return
appNode
;
return
appNode
;
}
}
...
@@ -263,7 +253,7 @@ public class LiteModelService {
...
@@ -263,7 +253,7 @@ public class LiteModelService {
}
}
public
FileItem
uploadFile
(
MultipartFile
multipartFile
)
{
public
FileItem
uploadFile
(
MultipartFile
multipartFile
)
{
FileItem
item
=
null
;
FileItem
item
;
// 获取文件名
// 获取文件名
String
fileName
=
multipartFile
.
getOriginalFilename
();
String
fileName
=
multipartFile
.
getOriginalFilename
();
// 获取文件后缀
// 获取文件后缀
...
@@ -324,7 +314,7 @@ public class LiteModelService {
...
@@ -324,7 +314,7 @@ public class LiteModelService {
public
String
exportFile
(
List
<
MetaModel
>
model
){
public
String
exportFile
(
List
<
MetaModel
>
model
){
List
<
AssembleModel
>
temp
=
new
ArrayList
<>();
List
<
AssembleModel
>
temp
=
new
ArrayList
<>();
for
(
MetaModel
metaModel
:
model
)
{
for
(
MetaModel
ignored
:
model
)
{
temp
.
add
(
null
);
temp
.
add
(
null
);
}
}
String
json
=
JSON
.
toJSONString
(
temp
);
String
json
=
JSON
.
toJSONString
(
temp
);
...
@@ -332,33 +322,4 @@ public class LiteModelService {
...
@@ -332,33 +322,4 @@ public class LiteModelService {
return
fileName
;
return
fileName
;
}
}
public
List
<
AssembleModel
>
translateFile
(
MultipartFile
file
){
BufferedReader
reader
=
null
;
String
ans
=
""
;
try
{
Reader
read
=
new
InputStreamReader
(
file
.
getInputStream
(),
"utf-8"
);
reader
=
new
BufferedReader
(
read
);
String
tmpString
=
null
;
while
((
tmpString
=
reader
.
readLine
())
!=
null
){
ans
+=
tmpString
;
}
if
(
StringUtils
.
isEmpty
(
ans
)){
throw
new
BadRequestAlertException
(
"文件内容为空"
,
""
,
""
);
}
List
<
AssembleModel
>
assembleModel
=
JSONObject
.
parseArray
(
ans
,
AssembleModel
.
class
);
return
assembleModel
;
}
catch
(
Exception
e
){
return
null
;
}
finally
{
if
(
reader
!=
null
){
try
{
reader
.
close
();
}
catch
(
IOException
ee
){
ee
.
printStackTrace
();
}
}
}
}
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录