Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 657398a6
由
LN
编写于
2021-12-17 13:26:21 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
锡膏管理图标修改。资源不同type的code可以重复。
1 个父辈
4b7908d5
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
20 行增加
和
140 行删除
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
src/main/java/com/neotel/smfcore/core/language/rest/LanguageMsgController.java
src/main/java/com/neotel/smfcore/core/language/service/nanager/impl/LanguageMsgManagerImpl.java
src/main/java/com/neotel/smfcore/core/language/util/MessageUtils.java
src/main/java/com/neotel/smfcore/core/system/util/DevicesStatusUtil.java
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
查看文件 @
657398a
...
@@ -205,11 +205,11 @@ public class DataInitManager {
...
@@ -205,11 +205,11 @@ public class DataInitManager {
menus
.
addAll
(
createMenus
(
msd
,
msdManage
,
msdData
,
msdSetting
));
menus
.
addAll
(
createMenus
(
msd
,
msdManage
,
msdData
,
msdSetting
));
Menu
solderPaste
=
Menu
.
CreatePMenu
(
"锡膏管理"
,
20
,
"solderPaste"
,
2
,
"
MSD
"
);
Menu
solderPaste
=
Menu
.
CreatePMenu
(
"锡膏管理"
,
20
,
"solderPaste"
,
2
,
"
sMana
"
);
Menu
solderPasteKanban
=
new
Menu
(
new
ArrayList
<
Menu
>(),
1
,
"solderPasteKanban"
,
"设备概览"
,
1
,
"solderPasteKanban"
,
"neolight/solderPasteKanban/index"
,
""
,
0
,
"
MSDManager
"
);
Menu
solderPasteKanban
=
new
Menu
(
new
ArrayList
<
Menu
>(),
1
,
"solderPasteKanban"
,
"设备概览"
,
1
,
"solderPasteKanban"
,
"neolight/solderPasteKanban/index"
,
""
,
0
,
"
sKanban
"
);
Menu
solderPasteManage
=
new
Menu
(
new
ArrayList
<
Menu
>(),
1
,
"solderPasteManage"
,
"库存"
,
1
,
"solderPasteManage"
,
"neolight/solderPasteManage/index"
,
""
,
0
,
"
MSDManag
er"
);
Menu
solderPasteManage
=
new
Menu
(
new
ArrayList
<
Menu
>(),
1
,
"solderPasteManage"
,
"库存"
,
1
,
"solderPasteManage"
,
"neolight/solderPasteManage/index"
,
""
,
0
,
"
sold
er"
);
Menu
solderPasteData
=
new
Menu
(
new
ArrayList
<
Menu
>(),
1
,
"solderPasteData"
,
"追溯性"
,
1
,
"solderPasteData"
,
"neolight/solderPasteData/index"
,
""
,
0
,
"
MSD
Data"
);
Menu
solderPasteData
=
new
Menu
(
new
ArrayList
<
Menu
>(),
1
,
"solderPasteData"
,
"追溯性"
,
1
,
"solderPasteData"
,
"neolight/solderPasteData/index"
,
""
,
0
,
"
s
Data"
);
Menu
solderPasteSetting
=
new
Menu
(
new
ArrayList
<
Menu
>(),
1
,
"solderPasteSetting"
,
"设置"
,
1
,
"solderPasteSetting"
,
"neolight/solderPasteSetting/index"
,
""
,
0
,
"
MSDSet
"
);
Menu
solderPasteSetting
=
new
Menu
(
new
ArrayList
<
Menu
>(),
1
,
"solderPasteSetting"
,
"设置"
,
1
,
"solderPasteSetting"
,
"neolight/solderPasteSetting/index"
,
""
,
0
,
"
system
"
);
menus
.
addAll
(
createMenus
(
solderPaste
,
solderPasteKanban
,
solderPasteManage
,
solderPasteData
,
solderPasteSetting
));
menus
.
addAll
(
createMenus
(
solderPaste
,
solderPasteKanban
,
solderPasteManage
,
solderPasteData
,
solderPasteSetting
));
//物料管理:元器件管理,条形码管理
//物料管理:元器件管理,条形码管理
...
...
src/main/java/com/neotel/smfcore/core/language/rest/LanguageMsgController.java
查看文件 @
657398a
...
@@ -3,11 +3,8 @@ package com.neotel.smfcore.core.language.rest;
...
@@ -3,11 +3,8 @@ package com.neotel.smfcore.core.language.rest;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.csv.CsvReader
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.Md5Utls
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.language.rest.bean.dto.LanguageMsgDto
;
import
com.neotel.smfcore.core.language.rest.bean.dto.LanguageMsgDto
;
...
@@ -21,12 +18,10 @@ import com.neotel.smfcore.core.language.service.po.LanguageMsg;
...
@@ -21,12 +18,10 @@ import com.neotel.smfcore.core.language.service.po.LanguageMsg;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.bean.FileProperties
;
import
com.neotel.smfcore.security.bean.FileProperties
;
import
com.neotel.smfcore.security.service.po.User
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.mapstruct.ap.shaded.freemarker.ext.beans.HashAdapter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
...
@@ -93,14 +88,14 @@ public class LanguageMsgController {
...
@@ -93,14 +88,14 @@ public class LanguageMsgController {
String
lanType
=
getLanTypeByFileName
(
uploadFile
.
getOriginalFilename
());
String
lanType
=
getLanTypeByFileName
(
uploadFile
.
getOriginalFilename
());
if
(
smfclientType
.
contains
(
fileType
))
{
if
(
smfclientType
.
contains
(
fileType
))
{
//客户端js文件处理
//客户端js文件处理
Map
<
String
,
String
>
proMap
=
readJsFile
(
file
);
Map
<
String
,
String
>
proMap
=
MessageUtils
.
readJsFile
(
file
);
resultMsg
=
ResourceUpload
(
uploadFile
.
getOriginalFilename
(),
proMap
,
lanType
,
"smfclient"
);
resultMsg
=
ResourceUpload
(
uploadFile
.
getOriginalFilename
(),
proMap
,
lanType
,
"smfclient"
);
}
else
if
(
smfcoreType
.
contains
(
fileType
))
{
}
else
if
(
smfcoreType
.
contains
(
fileType
))
{
Map
<
String
,
String
>
proMap
=
MessageUtils
.
R
eadPropertiesFile
(
file
);
Map
<
String
,
String
>
proMap
=
MessageUtils
.
r
eadPropertiesFile
(
file
);
resultMsg
=
ResourceUpload
(
uploadFile
.
getOriginalFilename
(),
proMap
,
lanType
,
""
);
resultMsg
=
ResourceUpload
(
uploadFile
.
getOriginalFilename
(),
proMap
,
lanType
,
""
);
}
}
if
(
csvType
.
equals
(
fileType
)){
if
(
csvType
.
equals
(
fileType
)){
List
<
LanguageMsg
>
list
=
CsvFileRead
(
file
.
getAbsolutePath
());
List
<
LanguageMsg
>
list
=
MessageUtils
.
readCsvFile
(
file
.
getAbsolutePath
(),
dataCache
.
getLanguageList
());
msgListUpload
(
list
);
msgListUpload
(
list
);
}
}
return
ResultBean
.
newOkResult
(
resultMsg
);
return
ResultBean
.
newOkResult
(
resultMsg
);
...
@@ -232,6 +227,7 @@ public class LanguageMsgController {
...
@@ -232,6 +227,7 @@ public class LanguageMsgController {
return
list
;
return
list
;
}
}
@ApiOperation
(
"客户端提交资源列表:只增加不修改"
)
@ApiOperation
(
"客户端提交资源列表:只增加不修改"
)
@PostMapping
(
value
=
"/resource"
)
@PostMapping
(
value
=
"/resource"
)
@AnonymousAccess
@AnonymousAccess
...
@@ -317,7 +313,7 @@ public class LanguageMsgController {
...
@@ -317,7 +313,7 @@ public class LanguageMsgController {
proMap
.
keySet
())
{
proMap
.
keySet
())
{
String
msgStr
=
proMap
.
get
(
key
);
String
msgStr
=
proMap
.
get
(
key
);
LanguageMsg
msg
=
MessageUtils
.
getMsg
(
key
);
LanguageMsg
msg
=
MessageUtils
.
getMsg
(
type
,
key
);
//导入时只能新增不能修改
//导入时只能新增不能修改
if
(
msg
==
null
)
{
if
(
msg
==
null
)
{
msg
=
new
LanguageMsg
(
key
,
msgStr
,
type
);
msg
=
new
LanguageMsg
(
key
,
msgStr
,
type
);
...
@@ -353,124 +349,6 @@ public class LanguageMsgController {
...
@@ -353,124 +349,6 @@ public class LanguageMsgController {
return
"ok"
;
return
"ok"
;
}
}
private
Map
<
String
,
String
>
readJsFile
(
File
file
){
Map
<
String
,
String
>
map
=
new
HashMap
<>();
try
(
FileInputStream
fis
=
new
FileInputStream
(
file
.
getPath
());
InputStreamReader
isr
=
new
InputStreamReader
(
fis
,
"UTF-8"
);
BufferedReader
br
=
new
BufferedReader
(
isr
)
)
{
String
line
;
//网友推荐更加简洁的写法
int
lineIndex
=-
1
;
String
currNodeName
=
""
;
while
((
line
=
br
.
readLine
())
!=
null
)
{
lineIndex
++;
// if(lineIndex==0){
// continue;
// }
if
(
ObjectUtil
.
isEmpty
(
line
)){
continue
;
}
if
(
line
.
contains
(
"{"
)){
if
(
line
.
contains
(
"="
)){
currNodeName
=
""
;
}
else
{
int
dendIndex
=
line
.
indexOf
(
':'
);
String
lineNode
=
line
.
substring
(
0
,
dendIndex
).
trim
();
if
(
ObjectUtil
.
isEmpty
(
currNodeName
)){
currNodeName
=
lineNode
;
}
else
{
//节点名称+
currNodeName
=
currNodeName
+
"."
+
lineNode
;
}
}
}
else
if
(
line
.
contains
(
"}"
)){
//节点名称-
if
(
currNodeName
.
contains
(
"."
)){
int
endIndex
=
currNodeName
.
lastIndexOf
(
"."
);
currNodeName
=
currNodeName
.
substring
(
0
,
endIndex
);
}
else
{
currNodeName
=
""
;
}
}
else
if
(
line
.
contains
(
":"
)){
if
(
line
.
endsWith
(
","
)){
line
=
line
.
substring
(
0
,
line
.
length
()-
1
);
}
String
[]
array
=
line
.
replace
(
"'"
,
""
).
replace
(
"\""
,
""
).
split
(
":"
);
if
(
array
.
length
==
2
){
String
linekey
=
array
[
0
].
trim
();
String
lineValue
=
array
[
1
].
trim
();
map
.
put
(
currNodeName
+
"."
+
linekey
,
lineValue
);
}
}
}
}
catch
(
IOException
e
)
{
log
.
error
(
"readJsFile 出错:"
+
e
.
toString
());
e
.
printStackTrace
();
}
return
map
;
}
private
List
<
LanguageMsg
>
CsvFileRead
(
String
fileURL
)
throws
Exception
{
CsvReader
csvRead
=
CsvReader
.
newReader
(
fileURL
,
"编号"
,
"code"
);
int
codeIndex
=
csvRead
.
getCsvIndex
(
"编号"
,
"code"
);
int
typeIndex
=
csvRead
.
getCsvIndex
(
"类型"
,
"type"
);
int
msgIndex
=
csvRead
.
getCsvIndex
(
"内容"
,
"msg"
);
Map
<
String
,
Integer
>
lanCodeIndex
=
new
HashMap
<>()
;
List
<
LanguageInfo
>
languageInfos
=
dataCache
.
getLanguageList
();
for
(
LanguageInfo
lan:
languageInfos
)
{
int
lanIndex
=
csvRead
.
getCsvIndex
(
lan
.
getLanCode
(),
lan
.
getLanName
());
if
(
lanIndex
>=
0
){
lanCodeIndex
.
put
(
lan
.
getLanCode
(),
lanIndex
);
}
}
int
row
=
1
;
int
newRowCount
=
0
;
int
updateRowCount
=
0
;
String
msg
=
""
;
List
<
LanguageMsg
>
list
=
new
ArrayList
<>();
while
(
csvRead
.
readRecord
())
{
row
++;
String
[]
lineValues
=
csvRead
.
getValues
();
LanguageMsg
languageMsg
=
new
LanguageMsg
();
String
code
=
lineValues
[
codeIndex
];
String
type
=
lineValues
[
typeIndex
];
String
msgStr
=
lineValues
[
msgIndex
];
if
(
code
.
isEmpty
()
||
type
.
isEmpty
()
||
msgStr
.
isEmpty
())
{
log
.
warn
(
"第"
+
row
+
"行中有空白内容,此行忽略"
);
continue
;
}
languageMsg
.
setMsg
(
msgStr
);
languageMsg
.
setCode
(
code
);
languageMsg
.
setType
(
type
);
for
(
String
lan
:
lanCodeIndex
.
keySet
())
{
int
lanIndex
=
lanCodeIndex
.
get
(
lan
);
String
lanMsg
=
lineValues
[
lanIndex
];
if
(!
lanMsg
.
isEmpty
()){
languageMsg
.
setContent
(
lan
,
lanMsg
);
}
}
list
.
add
(
languageMsg
);
}
return
list
;
}
private
void
msgListUpload
(
List
<
LanguageMsg
>
msgList
)
{
private
void
msgListUpload
(
List
<
LanguageMsg
>
msgList
)
{
List
<
LanguageMsg
>
newLanguageList
=
new
ArrayList
<>();
List
<
LanguageMsg
>
newLanguageList
=
new
ArrayList
<>();
...
@@ -501,7 +379,7 @@ public class LanguageMsgController {
...
@@ -501,7 +379,7 @@ public class LanguageMsgController {
//判断是否是新增
//判断是否是新增
LanguageMsg
oldMsg
=
MessageUtils
.
getMsg
(
msg
.
getCode
());
LanguageMsg
oldMsg
=
MessageUtils
.
getMsg
(
msg
.
get
Type
(),
msg
.
get
Code
());
if
(
oldMsg
==
null
){
if
(
oldMsg
==
null
){
newLanguageList
.
add
(
msg
);
newLanguageList
.
add
(
msg
);
}
}
...
...
src/main/java/com/neotel/smfcore/core/language/service/nanager/impl/LanguageMsgManagerImpl.java
查看文件 @
657398a
...
@@ -89,19 +89,19 @@ public class LanguageMsgManagerImpl implements ILanguageMsgManager {
...
@@ -89,19 +89,19 @@ public class LanguageMsgManagerImpl implements ILanguageMsgManager {
@Override
@Override
public
LanguageMsg
saveMsg
(
LanguageMsg
resources
)
{
public
LanguageMsg
saveMsg
(
LanguageMsg
resources
)
{
if
(
resources
.
getCode
()
==
null
)
{
if
(
ObjectUtil
.
isEmpty
(
resources
.
getCode
()
)
)
{
throw
new
ValidateException
(
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"code"
});
throw
new
ValidateException
(
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"code"
});
}
}
if
(
resources
.
getMsg
()
==
null
)
{
if
(
ObjectUtil
.
isEmpty
(
resources
.
getMsg
()
)
)
{
throw
new
ValidateException
(
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"msg"
});
throw
new
ValidateException
(
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"msg"
});
}
}
if
(
resources
.
getType
()
==
null
)
{
if
(
ObjectUtil
.
isEmpty
(
resources
.
getType
()
)
)
{
throw
new
ValidateException
(
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"type"
});
throw
new
ValidateException
(
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"type"
});
}
}
if
(
resources
.
getContentList
()
==
null
)
{
if
(
ObjectUtil
.
isEmpty
(
resources
.
getContentList
()
)
)
{
resources
.
setContentList
(
new
ArrayList
<>());
resources
.
setContentList
(
new
ArrayList
<>());
}
}
Criteria
c
=
Criteria
.
where
(
"code"
).
is
(
resources
.
getCode
());
Criteria
c
=
Criteria
.
where
(
"code"
).
is
(
resources
.
getCode
())
.
and
(
"type"
).
is
(
resources
.
getType
())
;
String
logName
=
"新增资源:"
;
String
logName
=
"新增资源:"
;
if
(
resources
.
getId
()
!=
null
)
{
if
(
resources
.
getId
()
!=
null
)
{
logName
=
"修改资源:"
;
logName
=
"修改资源:"
;
...
@@ -109,7 +109,7 @@ public class LanguageMsgManagerImpl implements ILanguageMsgManager {
...
@@ -109,7 +109,7 @@ public class LanguageMsgManagerImpl implements ILanguageMsgManager {
}
//code不能重复
}
//code不能重复
LanguageMsg
result
=
languageMsgDao
.
findOne
(
new
Query
(
c
));
LanguageMsg
result
=
languageMsgDao
.
findOne
(
new
Query
(
c
));
if
(
result
!=
null
)
{
if
(
result
!=
null
)
{
throw
new
ValidateException
(
"smfcore.resourcesExist"
,
"资源[
"
+
resources
.
getCode
()
+
"]已存在"
);
throw
new
ValidateException
(
"smfcore.resourcesExist"
,
"资源[
{0}][{1}]已存在"
,
new
String
[]{
resources
.
getType
(),
resources
.
getCode
()}
);
}
}
Query
query
=
new
Query
(
c
);
Query
query
=
new
Query
(
c
);
...
...
src/main/java/com/neotel/smfcore/core/language/util/MessageUtils.java
查看文件 @
657398a
此文件的差异被折叠,
点击展开。
src/main/java/com/neotel/smfcore/core/system/util/DevicesStatusUtil.java
查看文件 @
657398a
...
@@ -116,7 +116,9 @@ public class DevicesStatusUtil {
...
@@ -116,7 +116,9 @@ public class DevicesStatusUtil {
public
static
Map
<
String
,
String
>
getAndRemoveOp
(
String
cid
){
public
static
Map
<
String
,
String
>
getAndRemoveOp
(
String
cid
){
Map
<
String
,
String
>
opMap
=
storageOpMap
.
get
(
cid
);
Map
<
String
,
String
>
opMap
=
storageOpMap
.
get
(
cid
);
opMap
.
remove
(
cid
);
if
(
opMap
!=
null
){
opMap
.
remove
(
cid
);
}
return
opMap
;
return
opMap
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论