Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 9a5deae9
由
LN
编写于
2022-02-08 16:24:20 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
提示信息语言切换,入库单增加模板下载,BUG修改
1 个父辈
b3c77f8b
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
97 行增加
和
2 行删除
src/main/java/com/neotel/smfcore/common/bean/ResultBean.java
src/main/java/com/neotel/smfcore/common/service/CommonResponseAdvice.java
src/main/java/com/neotel/smfcore/core/barcode/utils/QrcodeUtils.java
src/main/java/com/neotel/smfcore/core/inList/rest/InListController.java
src/main/java/com/neotel/smfcore/core/inList/rest/bean/query/InListQueryCondition.java
src/main/java/com/neotel/smfcore/common/bean/ResultBean.java
查看文件 @
9a5deae
...
@@ -30,7 +30,7 @@ public class ResultBean<T> {
...
@@ -30,7 +30,7 @@ public class ResultBean<T> {
ResultBean
result
=
new
ResultBean
();
ResultBean
result
=
new
ResultBean
();
result
.
setCode
(
code
);
result
.
setCode
(
code
);
result
.
setMsgKey
(
msgKey
);
result
.
setMsgKey
(
msgKey
);
result
.
setParams
(
params
);
result
.
setMsg
(
MessageUtils
.
getText
(
msgKey
,
params
,
new
Locale
(
SecurityUtils
.
getCurrentUserLanguage
()),
msg
));
result
.
setMsg
(
MessageUtils
.
getText
(
msgKey
,
params
,
new
Locale
(
SecurityUtils
.
getCurrentUserLanguage
()),
msg
));
if
(
writeLog
)
{
if
(
writeLog
)
{
log
.
info
(
result
.
getMsg
());
log
.
info
(
result
.
getMsg
());
...
@@ -44,6 +44,7 @@ public class ResultBean<T> {
...
@@ -44,6 +44,7 @@ public class ResultBean<T> {
ResultBean
result
=
new
ResultBean
();
ResultBean
result
=
new
ResultBean
();
result
.
setCode
(
0
);
result
.
setCode
(
0
);
result
.
setMsgKey
(
msgKey
);
result
.
setMsgKey
(
msgKey
);
result
.
setParams
(
params
);
result
.
setMsg
(
MessageUtils
.
getText
(
msgKey
,
params
,
new
Locale
(
SecurityUtils
.
getCurrentUserLanguage
()),
msg
));
result
.
setMsg
(
MessageUtils
.
getText
(
msgKey
,
params
,
new
Locale
(
SecurityUtils
.
getCurrentUserLanguage
()),
msg
));
result
.
setData
(
data
);
result
.
setData
(
data
);
return
result
;
return
result
;
...
@@ -53,6 +54,11 @@ public class ResultBean<T> {
...
@@ -53,6 +54,11 @@ public class ResultBean<T> {
return
newOkResult
(
"smfcore.ok"
,
"ok"
,
data
);
return
newOkResult
(
"smfcore.ok"
,
"ok"
,
data
);
}
}
public
void
updateLocal
(
Locale
locale
)
{
String
newMsg
=
MessageUtils
.
getText
(
getMsgKey
(),
getParams
(),
locale
,
getMsg
());
setMsg
(
newMsg
);
}
@ApiModelProperty
(
"结果码,0为正常,其他值表示异常"
)
@ApiModelProperty
(
"结果码,0为正常,其他值表示异常"
)
private
int
code
;
private
int
code
;
@ApiModelProperty
(
"提示消息国际化key"
)
@ApiModelProperty
(
"提示消息国际化key"
)
...
@@ -61,6 +67,8 @@ public class ResultBean<T> {
...
@@ -61,6 +67,8 @@ public class ResultBean<T> {
@ApiModelProperty
(
"提示信息"
)
@ApiModelProperty
(
"提示信息"
)
private
String
msg
;
private
String
msg
;
private
String
[]
params
;
private
T
data
;
private
T
data
;
/**
/**
...
...
src/main/java/com/neotel/smfcore/common/service/CommonResponseAdvice.java
0 → 100644
查看文件 @
9a5deae
package
com
.
neotel
.
smfcore
.
common
.
service
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.server.ServerHttpRequest
;
import
org.springframework.http.server.ServerHttpResponse
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice
;
import
java.util.List
;
import
java.util.Locale
;
@Slf4j
@ControllerAdvice
public
class
CommonResponseAdvice
implements
ResponseBodyAdvice
<
Object
>
{
@Override
public
boolean
supports
(
MethodParameter
returnType
,
Class
converterType
)
{
return
filter
(
returnType
);
}
/**
* 根据返回类型来判断是否需要进行后续操作
* @param methodParameter
* @return
*/
private
boolean
filter
(
MethodParameter
methodParameter
)
{
return
true
;
}
@Override
public
Object
beforeBodyWrite
(
Object
body
,
MethodParameter
returnType
,
MediaType
selectedContentType
,
Class
selectedConverterType
,
ServerHttpRequest
request
,
ServerHttpResponse
response
)
{
try
{
//获取返回值类型
String
returnClassType
=
returnType
.
getParameterType
().
getSimpleName
();
//如果返回值类型为void,则默认返回成功
if
(
"void"
.
equals
(
returnClassType
))
{
return
body
;
}
else
if
(
"ResultBean"
.
equals
(
returnClassType
))
{
ResultBean
resultBean
=
(
ResultBean
)
body
;
HttpHeaders
headers
=
request
.
getHeaders
();
List
<
Locale
>
locales
=
headers
.
getAcceptLanguageAsLocales
();
if
(
locales
!=
null
&&
locales
.
size
()
>
0
)
{
resultBean
.
updateLocal
(
locales
.
get
(
0
));
}
return
resultBean
;
// resultBean.updateLocal(request.getLocale());
}
}
catch
(
Exception
ex
)
{
log
.
error
(
"CommonResponseAdvice beforeBodyWrite 出错:"
+
ex
.
toString
());
}
return
body
;
}
}
src/main/java/com/neotel/smfcore/core/barcode/utils/QrcodeUtils.java
查看文件 @
9a5deae
...
@@ -122,7 +122,7 @@ public class QrcodeUtils {
...
@@ -122,7 +122,7 @@ public class QrcodeUtils {
float
[]
columnWidths
=
{
0.6f
,
1
f
};
float
[]
columnWidths
=
{
0.6f
,
1
f
};
table
.
setWidths
(
columnWidths
);
table
.
setWidths
(
columnWidths
);
table
.
addCell
(
new
Phrase
(
"Reel I
d
:"
,
boldFont
));
table
.
addCell
(
new
Phrase
(
"Reel I
D
:"
,
boldFont
));
table
.
addCell
(
new
Phrase
(
qrcodeContent
,
boldFont
));
table
.
addCell
(
new
Phrase
(
qrcodeContent
,
boldFont
));
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
qrcodeContent
);
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
qrcodeContent
);
...
...
src/main/java/com/neotel/smfcore/core/inList/rest/InListController.java
查看文件 @
9a5deae
...
@@ -24,6 +24,7 @@ import com.neotel.smfcore.core.inList.util.InListCache;
...
@@ -24,6 +24,7 @@ import com.neotel.smfcore.core.inList.util.InListCache;
import
com.neotel.smfcore.core.storage.enums.DeviceType
;
import
com.neotel.smfcore.core.storage.enums.DeviceType
;
import
com.neotel.smfcore.core.storage.service.manager.IStorageManager
;
import
com.neotel.smfcore.core.storage.service.manager.IStorageManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.system.bean.OrderSetting
;
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
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -38,7 +39,9 @@ import org.springframework.util.ObjectUtils;
...
@@ -38,7 +39,9 @@ import org.springframework.util.ObjectUtils;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
...
@@ -226,6 +229,33 @@ public class InListController {
...
@@ -226,6 +229,33 @@ public class InListController {
return
ResultBean
.
newOkResult
(
"smfcore.inlist.setOk"
,
"设置成功"
,
""
);
return
ResultBean
.
newOkResult
(
"smfcore.inlist.setOk"
,
"设置成功"
,
""
);
}
}
@ApiOperation
(
"下载入库单模板"
)
@GetMapping
(
value
=
"/downloadModel"
)
@PreAuthorize
(
"@el.check('inList')"
)
public
void
downloadModel
(
HttpServletResponse
response
)
throws
IOException
{
downloadInListModel
(
response
);
}
public
void
downloadInListModel
(
HttpServletResponse
response
)
throws
IOException
{
try
{
List
<
Map
<
String
,
Object
>>
maps
=
new
ArrayList
<>();
List
<
String
>
titles
=
new
ArrayList
<>();
OrderSetting
orderSetting
=
dataCache
.
getOrderSetting
();
titles
.
add
(
"PN"
);
titles
.
add
(
"NUM"
);
for
(
int
i
=
1
;
i
<=
5
;
i
++)
{
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"PN"
,
"PN"
+
i
);
map
.
put
(
"NUM"
,
i
*
1000
);
maps
.
add
(
map
);
}
FileUtil
.
downloadCSV
(
maps
,
titles
,
response
);
}
catch
(
Exception
e
)
{
log
.
error
(
"导出失败"
+
e
.
getMessage
(),
e
);
}
}
private
Map
<
String
,
List
<
InListItem
>>
readCsvFile
(
String
fileName
,
String
fileURL
)
{
private
Map
<
String
,
List
<
InListItem
>>
readCsvFile
(
String
fileName
,
String
fileURL
)
{
...
...
src/main/java/com/neotel/smfcore/core/inList/rest/bean/query/InListQueryCondition.java
查看文件 @
9a5deae
...
@@ -15,5 +15,6 @@ public class InListQueryCondition {
...
@@ -15,5 +15,6 @@ public class InListQueryCondition {
//状态,0=等待,1=异常,2=OK
//状态,0=等待,1=异常,2=OK
@QueryCondition
private
Integer
status
;
private
Integer
status
;
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论