Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
changZhouShelf
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 90a52008
由
sunke
编写于
2021-03-09 09:28:09 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
用户名重复验证
物料尺寸上传功能优化
1 个父辈
d1d4522c
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
72 行增加
和
41 行删除
myproject/src/main/java/com/myproject/manager/impl/ComponentManagerImpl.java
myproject/src/main/java/com/myproject/webapp/controller/FileUploadController.java
myproject/src/main/java/com/myproject/webapp/controller/storage/SzShelfController.java
myproject/src/main/java/com/myproject/webapp/controller/user/UserUpdateController.java
myproject/src/main/resources/StorageResources.properties
myproject/src/main/resources/StorageResources_en.properties
myproject/src/main/resources/StorageResources_zh_CN.properties
myproject/src/main/webapp/WEB-INF/pages/user/userUpdate.jsp
myproject/src/main/webapp/common/fileUpload.jsp
myproject/src/main/java/com/myproject/manager/impl/ComponentManagerImpl.java
查看文件 @
90a5200
...
@@ -120,16 +120,16 @@ public class ComponentManagerImpl implements IComponentManager {
...
@@ -120,16 +120,16 @@ public class ComponentManagerImpl implements IComponentManager {
}
}
List
<
StoragePos
>
poses
=
storagePosDao
.
findListByCondition
(
new
String
[]{
"barcode.partNumber, barcode.providerNumber"
},
new
String
[]{
component
.
getPartNumber
(),
component
.
getProvider
()});
List
<
StoragePos
>
poses
=
storagePosDao
.
findListByCondition
(
new
String
[]{
"barcode.partNumber, barcode.providerNumber"
},
new
String
[]{
component
.
getPartNumber
(),
component
.
getProvider
()});
for
(
StoragePos
pos
:
poses
)
{
if
(
poses
!=
null
){
Barcode
barcode
=
pos
.
getBarcode
();
for
(
StoragePos
pos
:
poses
)
{
log
.
info
(
"更新库位["
+
pos
.
getPosName
()+
"]中条码["
+
barcode
.
getBarcode
()+
"]的尺寸信息["
+
barcode
.
getPlateSize
()+
"x"
+
barcode
.
getHeight
()
+
"]为["
+
newW
+
"x"
+
newH
+
"]"
);
Barcode
barcode
=
pos
.
getBarcode
();
barcode
.
setPlateSize
(
newW
);
log
.
info
(
"更新库位["
+
pos
.
getPosName
()+
"]中条码["
+
barcode
.
getBarcode
()+
"]的尺寸信息["
+
barcode
.
getPlateSize
()+
"x"
+
barcode
.
getHeight
()
+
"]为["
+
newW
+
"x"
+
newH
+
"]"
);
barcode
.
setHeight
(
newH
);
barcode
.
setPlateSize
(
newW
);
pos
.
setBarcode
(
barcode
);
barcode
.
setHeight
(
newH
);
storagePosDao
.
save
(
pos
);
pos
.
setBarcode
(
barcode
);
storagePosDao
.
save
(
pos
);
}
}
}
}
}
return
component
;
return
component
;
}
}
...
...
myproject/src/main/java/com/myproject/webapp/controller/FileUploadController.java
查看文件 @
90a5200
...
@@ -143,9 +143,12 @@ public class FileUploadController extends BaseFormController {
...
@@ -143,9 +143,12 @@ public class FileUploadController extends BaseFormController {
String
link
=
request
.
getContextPath
()
+
"/resources"
+
"/"
+
request
.
getRemoteUser
()
+
"/"
;
String
link
=
request
.
getContextPath
()
+
"/resources"
+
"/"
+
request
.
getRemoteUser
()
+
"/"
;
request
.
setAttribute
(
"link"
,
link
+
file
.
getOriginalFilename
());
request
.
setAttribute
(
"link"
,
link
+
file
.
getOriginalFilename
());
log
.
debug
(
"Upload file is saved as: "
+
fileURL
);
log
.
info
(
"收到上传["
+
type
+
"]文件: "
+
fileURL
);
if
(
StringUtils
.
isEmpty
(
type
)){
type
=
StorageConstants
.
COMPONENT
;
}
if
(!
StringUtils
.
isEmpty
(
type
))
{
if
(!
StringUtils
.
isEmpty
(
type
))
{
log
.
debug
(
"Upload file type is: "
+
type
);
log
.
info
(
"Upload file type is: "
+
type
);
try
{
try
{
if
(
StorageConstants
.
COMPONENT
.
equals
(
type
))
{
if
(
StorageConstants
.
COMPONENT
.
equals
(
type
))
{
String
message
=
handleComponent
(
fileURL
);
String
message
=
handleComponent
(
fileURL
);
...
@@ -160,21 +163,17 @@ public class FileUploadController extends BaseFormController {
...
@@ -160,21 +163,17 @@ public class FileUploadController extends BaseFormController {
//saveMessage(request,message);
//saveMessage(request,message);
}
}
}
catch
(
ExcelParseException
e
)
{
}
catch
(
ExcelParseException
e
)
{
log
.
error
(
e
);
log
.
error
(
"ExcelParseException文件解析失败"
,
e
);
log
.
error
(
e
.
getMessage
());
saveError
(
request
,
e
.
getMessage
());
saveError
(
request
,
e
.
getMessage
());
}
catch
(
IOException
ioe
)
{
}
catch
(
IOException
ioe
)
{
log
.
error
(
ioe
);
log
.
error
(
"IOException文件解析失败"
,
ioe
);
log
.
error
(
ioe
.
getMessage
());
saveError
(
request
,
getText
(
"errors.upload.fileNotExist"
,
request
.
getLocale
()));
saveError
(
request
,
getText
(
"errors.upload.fileNotExist"
,
request
.
getLocale
()));
}
catch
(
ValidateException
ve
)
{
}
catch
(
Exception
ve
)
{
String
errorMsg
=
getText
(
ve
.
getMessage
(),
ve
.
getParams
(),
request
.
getLocale
());
log
.
error
(
"文件解析失败"
,
ve
);
log
.
error
(
ve
);
saveError
(
request
,
ve
.
getMessage
());
log
.
error
(
errorMsg
);
saveError
(
request
,
errorMsg
);
}
finally
{
}
finally
{
if
(
StorageConstants
.
COMPONENT
.
equals
(
type
))
{
if
(
StorageConstants
.
COMPONENT
.
equals
(
type
))
{
response
.
sendRedirect
(
StorageConstants
.
COMPONENT_SEARCH_VIEW
);
response
.
sendRedirect
(
request
.
getContextPath
()
+
StorageConstants
.
COMPONENT_SEARCH_VIEW
);
//return StorageConstants.COMPONENT_SEARCH_VIEW;
//return StorageConstants.COMPONENT_SEARCH_VIEW;
return
null
;
return
null
;
}
else
if
(
StorageConstants
.
BOM_TYPE
.
equals
(
type
))
{
}
else
if
(
StorageConstants
.
BOM_TYPE
.
equals
(
type
))
{
...
@@ -233,6 +232,7 @@ public class FileUploadController extends BaseFormController {
...
@@ -233,6 +232,7 @@ public class FileUploadController extends BaseFormController {
protected
String
handleComponent
(
String
fileURL
)
throws
ExcelParseException
,
IOException
,
ValidateException
,
IllegalAccessException
,
InvocationTargetException
{
protected
String
handleComponent
(
String
fileURL
)
throws
ExcelParseException
,
IOException
,
ValidateException
,
IllegalAccessException
,
InvocationTargetException
{
log
.
info
(
"开始读取文件:"
+
fileURL
);
CsvReader
csvRead
=
new
CsvReader
(
fileURL
);
CsvReader
csvRead
=
new
CsvReader
(
fileURL
);
csvRead
.
setSkipEmptyRecords
(
true
);
//忽略空行
csvRead
.
setSkipEmptyRecords
(
true
);
//忽略空行
csvRead
.
setTrimWhitespace
(
true
);
//去除空格
csvRead
.
setTrimWhitespace
(
true
);
//去除空格
...
@@ -294,6 +294,7 @@ public class FileUploadController extends BaseFormController {
...
@@ -294,6 +294,7 @@ public class FileUploadController extends BaseFormController {
list
.
add
(
component
);
list
.
add
(
component
);
}
}
}
}
log
.
info
(
"共读取["
+
list
.
size
()+
"]行数据"
);
int
newRowCount
=
0
;
int
newRowCount
=
0
;
int
updateRowCount
=
0
;
int
updateRowCount
=
0
;
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
...
...
myproject/src/main/java/com/myproject/webapp/controller/storage/SzShelfController.java
查看文件 @
90a5200
...
@@ -257,7 +257,7 @@ public class SzShelfController extends BaseController {
...
@@ -257,7 +257,7 @@ public class SzShelfController extends BaseController {
lockPos
=
storagePosManager
.
save
(
lockPos
);
lockPos
=
storagePosManager
.
save
(
lockPos
);
//锁定成功,亮灯
//锁定成功,亮灯
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"锁定库位出错"
,
e
);
}
}
}
else
{
}
else
{
//料架上无料,无法锁定
//料架上无料,无法锁定
...
...
myproject/src/main/java/com/myproject/webapp/controller/user/UserUpdateController.java
查看文件 @
90a5200
...
@@ -109,6 +109,23 @@ public class UserUpdateController extends BaseUpdateController {
...
@@ -109,6 +109,23 @@ public class UserUpdateController extends BaseUpdateController {
}
else
{
}
else
{
try
{
try
{
if
(
super
.
isAdd
(
request
)){
if
(
super
.
isAdd
(
request
)){
User
existUser
=
null
;
try
{
existUser
=
userManager
.
getUserByUsername
(
user
.
getUsername
());
}
catch
(
Exception
ee
){
log
.
error
(
ee
.
getMessage
());
}
if
(
existUser
!=
null
){
//用户已存在,如果与当前用户Id不一致,认为是重复的
if
(
user
.
getId
()
==
null
||
!
user
.
getId
().
equals
(
existUser
.
getId
())){
result
.
rejectValue
(
"username"
,
"exist"
);
return
getSuccessView
();
}
}
String
authCode
=
user
.
getAuthCode
();
String
authCode
=
user
.
getAuthCode
();
if
(!
Strings
.
isNullOrEmpty
(
authCode
)){
if
(!
Strings
.
isNullOrEmpty
(
authCode
)){
//授权码必须唯一
//授权码必须唯一
...
@@ -118,6 +135,7 @@ public class UserUpdateController extends BaseUpdateController {
...
@@ -118,6 +135,7 @@ public class UserUpdateController extends BaseUpdateController {
return
getSuccessView
();
return
getSuccessView
();
}
}
}
}
userManager
.
saveUser
(
user
);
userManager
.
saveUser
(
user
);
saveMessage
(
request
,
getText
(
"user.saveSuccess"
,
request
.
getLocale
()));
saveMessage
(
request
,
getText
(
"user.saveSuccess"
,
request
.
getLocale
()));
return
getSuccessView
();
return
getSuccessView
();
...
...
myproject/src/main/resources/StorageResources.properties
查看文件 @
90a5200
...
@@ -239,6 +239,7 @@ user.language=Language
...
@@ -239,6 +239,7 @@ user.language=Language
user.email
=
Email
user.email
=
Email
user.authCode
=
Auth Code
user.authCode
=
Auth Code
exist.user.authCode
=
The authorization code already exists
exist.user.authCode
=
The authorization code already exists
exist.user.username
=
The username already exist
user.writeCard
=
Write Card
user.writeCard
=
Write Card
user.profile.edit
=
Profile Edit
user.profile.edit
=
Profile Edit
profile.password.subtitle
=
Password Change
profile.password.subtitle
=
Password Change
...
...
myproject/src/main/resources/StorageResources_en.properties
查看文件 @
90a5200
...
@@ -239,6 +239,7 @@ user.language=Language
...
@@ -239,6 +239,7 @@ user.language=Language
user.email
=
Email
user.email
=
Email
user.authCode
=
Auth Code
user.authCode
=
Auth Code
exist.user.authCode
=
The authorization code already exists
exist.user.authCode
=
The authorization code already exists
exist.user.username
=
The username already exist
user.writeCard
=
Write Card
user.writeCard
=
Write Card
user.profile.edit
=
Profile Edit
user.profile.edit
=
Profile Edit
profile.password.subtitle
=
Password Change
profile.password.subtitle
=
Password Change
...
...
myproject/src/main/resources/StorageResources_zh_CN.properties
查看文件 @
90a5200
...
@@ -239,6 +239,7 @@ user.language=\u8BED\u8A00
...
@@ -239,6 +239,7 @@ user.language=\u8BED\u8A00
user.email
=
\u
90AE
\u
7BB1
user.email
=
\u
90AE
\u
7BB1
user.authCode
=
\u6388\u6743\u7801
user.authCode
=
\u6388\u6743\u7801
exist.user.authCode
=
\u6388\u6743\u7801\u
5DF2
\u
5B58
\u5728
exist.user.authCode
=
\u6388\u6743\u7801\u
5DF2
\u
5B58
\u5728
exist.user.username
=
\u7528\u6237\u
540D
\u
5DF2
\u
5B58
\u5728
user.writeCard
=
\u5199\u5165\u5361\u7247
user.writeCard
=
\u5199\u5165\u5361\u7247
user.profile.edit
=
\u
8D44
\u6599\u
7F16
\u
8F91
user.profile.edit
=
\u
8D44
\u6599\u
7F16
\u
8F91
profile.password.subtitle
=
\u
4FEE
\u6539\u
5BC6
\u7801
profile.password.subtitle
=
\u
4FEE
\u6539\u
5BC6
\u7801
...
...
myproject/src/main/webapp/WEB-INF/pages/user/userUpdate.jsp
查看文件 @
90a5200
...
@@ -52,8 +52,10 @@
...
@@ -52,8 +52,10 @@
<div class="form-group">
<div class="form-group">
<label class="control-label col-md-2"><fmt:message key="user.username"/><span class="required"> * </span></label>
<label class="control-label col-md-2"><fmt:message key="user.username"/><span class="required"> * </span></label>
<div class="col-md-3 ${usernameErrorClass}">
<div class="col-md-3 ${usernameErrorClass}">
<form:input type="text" path="username" class="form-control"/>
<div style="text-align:left" class="input-group">
<form:errors path="username" cssClass="help-block"/>
<form:input type="text" path="username" class="form-control"/>
<form:errors path="username" cssClass="help-block"/>
</div>
</div>
</div>
<c:if test="${user.id == null}">
<c:if test="${user.id == null}">
...
@@ -79,8 +81,10 @@
...
@@ -79,8 +81,10 @@
</form:errors>
</form:errors>
<label class="control-label col-md-2"><fmt:message key="user.firstName"/><span class="required"> * </span></label>
<label class="control-label col-md-2"><fmt:message key="user.firstName"/><span class="required"> * </span></label>
<div class="col-md-3 ${firstNameErrorClass}">
<div class="col-md-3 ${firstNameErrorClass}">
<form:input type="text" id="barcode" path="firstName" class="form-control"/>
<div style="text-align:left" class="input-group">
<form:errors path="firstName" cssClass="help-block"/>
<form:input type="text" id="barcode" path="firstName" class="form-control"/>
<form:errors path="firstName" cssClass="help-block"/>
</div>
</div>
</div>
...
@@ -89,8 +93,10 @@
...
@@ -89,8 +93,10 @@
</form:errors>
</form:errors>
<label class="control-label col-md-2"><fmt:message key="user.lastName"/><span class="required"> * </span></label>
<label class="control-label col-md-2"><fmt:message key="user.lastName"/><span class="required"> * </span></label>
<div class="col-md-3 ${lastNameErrorClass}">
<div class="col-md-3 ${lastNameErrorClass}">
<form:input type="text" path="lastName" class="form-control"/>
<div style="text-align:left" class="input-group">
<form:errors path="lastName" cssClass="help-block"/>
<form:input type="text" path="lastName" class="form-control"/>
<form:errors path="lastName" cssClass="help-block"/>
</div>
</div>
</div>
</div>
</div>
...
@@ -100,13 +106,17 @@
...
@@ -100,13 +106,17 @@
</form:errors>
</form:errors>
<label class="control-label col-md-2"><fmt:message key="user.role"/><span class="required"> * </span></label>
<label class="control-label col-md-2"><fmt:message key="user.role"/><span class="required"> * </span></label>
<div class="col-md-3 ${roleIdErrorClass}">
<div class="col-md-3 ${roleIdErrorClass}">
<form:select path="role.id" cssClass="form-control" items="${roleList}" itemValue="id" itemLabel="name"/>
<div style="text-align:left" class="input-group">
<form:errors path="role.id" cssClass="help-block"/>
<form:select path="role.id" cssClass="form-control" items="${roleList}" itemValue="id" itemLabel="name"/>
<form:errors path="role.id" cssClass="help-block"/>
</div>
</div>
</div>
<label class="control-label col-md-2"><fmt:message key="user.language"/><span class="required"> * </span></label>
<label class="control-label col-md-2"><fmt:message key="user.language"/><span class="required"> * </span></label>
<div class="col-md-3 ">
<div class="col-md-3 ">
<form:select path="language" cssClass="form-control select2" items="<%= Language.values()%>" itemLabel="label" itemValue="value" id="language"/>
<div style="text-align:left" class="input-group">
<form:select path="language" cssClass="form-control select2" items="<%= Language.values()%>" itemLabel="label" itemValue="value" id="language"/>
</div>
</div>
</div>
</div>
</div>
...
@@ -123,17 +133,15 @@
...
@@ -123,17 +133,15 @@
<input name="email" type="hidden" value="test@test.com">
<input name="email" type="hidden" value="test@test.com">
<form:errors path="authCode" cssStyle="display: none">
<c:set var="authCodeErrorClass" value="has-error"/>
</form:errors>
<label class="control-label col-md-2">授权码</label>
<label class="control-label col-md-2">授权码</label>
<div class="col-md-3">
<div class="col-md-3
${authCodeErrorClass}
">
<div style="text-align:left" class="input-group">
<div style="text-align:left" class="input-group">
<form:input type="text" path="authCode" class="form-control"/>
<form:input type="text" path="authCode" class="form-control"/>
<%--<c:if test="${user.id != null}">--%>
<%--<span class="input-group-addon">--%>
<%--<a onclick="writeToCard();"><fmt:message key="写入卡片"/> </a>--%>
<%--</span>--%>
<%--</c:if>--%>
<form:errors path="authCode" cssClass="help-block"/>
<form:errors path="authCode" cssClass="help-block"/>
</div>
</div>
</div>
</div>
...
...
myproject/src/main/webapp/common/fileUpload.jsp
查看文件 @
90a5200
...
@@ -19,9 +19,8 @@
...
@@ -19,9 +19,8 @@
<div class="modal-body">
<div class="modal-body">
<%@include file="/common/success.jsp" %>
<%@include file="/common/success.jsp" %>
<%@include file="/common/error.jsp" %>
<%@include file="/common/error.jsp" %>
<form method="post" action="${ctx}/storage/fileupload?type=${fileType}¶m=${fileParam}"
<form method="post" action="${ctx}/storage/fileupload"
enctype="multipart/form-data"
enctype="multipart/form-data" id="uploadForm" cssClass="well">
onsubmit="return validateFileUpload(this)" id="uploadForm" cssClass="well">
<%--<spring:bind path="fileUpload.name">--%>
<%--<spring:bind path="fileUpload.name">--%>
<%--<div class="form-group${(not empty status.errorMessage) ? ' has-error' : ''}">--%>
<%--<div class="form-group${(not empty status.errorMessage) ? ' has-error' : ''}">--%>
<%--<%–</spring:bind>–%>--%>
<%--<%–</spring:bind>–%>--%>
...
@@ -32,6 +31,8 @@
...
@@ -32,6 +31,8 @@
<div class="form-group${(not empty status.errorMessage) ? ' has-error' : ''}">
<div class="form-group${(not empty status.errorMessage) ? ' has-error' : ''}">
<%--</spring:bind>--%>
<%--</spring:bind>--%>
<appfuse:label key="uploadForm.file" styleClass="control-label"/>
<appfuse:label key="uploadForm.file" styleClass="control-label"/>
<input type="hidden" name="type" value="${fileType}"/>
<input type="hidden" name="param" value="${fileParam}"/>
<input type="file" name="file" id="file" hidden/>
<input type="file" name="file" id="file" hidden/>
</div>
</div>
</div>
</div>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论