Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 70d19f00
由
LN
编写于
2021-07-28 17:14:44 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
调试修改
1 个父辈
18d34429
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
144 行增加
和
11 行删除
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/dto/BarcodeDto.java
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/dto/ComponentDto.java
src/main/java/com/neotel/smfcore/core/storage/rest/StorageController.java
src/main/java/com/neotel/smfcore/core/storage/rest/dto/StorageDto.java
src/main/java/com/neotel/smfcore/security/rest/UserController.java
src/main/java/com/neotel/smfcore/security/service/manager/impl/GroupManagerImpl.java
src/main/java/com/neotel/smfcore/security/service/manager/impl/UserManagerImpl.java
src/main/java/com/neotel/smfcore/security/service/po/Menu.java
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
查看文件 @
70d19f0
此文件的差异被折叠,
点击展开。
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/dto/BarcodeDto.java
查看文件 @
70d19f0
...
@@ -16,6 +16,8 @@ import java.util.List;
...
@@ -16,6 +16,8 @@ import java.util.List;
@Getter
@Getter
@Setter
@Setter
public
class
BarcodeDto
implements
Serializable
{
public
class
BarcodeDto
implements
Serializable
{
@ApiModelProperty
(
value
=
"ID"
)
private
String
id
;
@ApiModelProperty
(
"条码编号"
)
@ApiModelProperty
(
"条码编号"
)
private
String
barcode
;
private
String
barcode
;
...
...
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/dto/ComponentDto.java
查看文件 @
70d19f0
...
@@ -9,6 +9,8 @@ import java.io.Serializable;
...
@@ -9,6 +9,8 @@ import java.io.Serializable;
@Getter
@Getter
@Setter
@Setter
public
class
ComponentDto
implements
Serializable
{
public
class
ComponentDto
implements
Serializable
{
@ApiModelProperty
(
value
=
"ID"
)
private
String
id
;
@ApiModelProperty
(
"产品类型:0=元器件,1=锡膏,2=PCB,3=其他,4=夹具"
)
@ApiModelProperty
(
"产品类型:0=元器件,1=锡膏,2=PCB,3=其他,4=夹具"
)
private
int
type
=
COMPONENT_TYPE
.
COMPONENT
;
private
int
type
=
COMPONENT_TYPE
.
COMPONENT
;
...
@@ -89,14 +91,17 @@ public class ComponentDto implements Serializable {
...
@@ -89,14 +91,17 @@ public class ComponentDto implements Serializable {
@ApiModelProperty
(
"供应商编号"
)
@ApiModelProperty
(
"供应商编号"
)
private
String
providerNumber
;
private
String
providerNumber
;
@ApiModelProperty
(
"物料数量"
)
private
int
amount
;
private
int
amount
;
@ApiModelProperty
(
"报警值,与贴片机连机时使用,值小于1时为初始数量amount百分比,大于等于1时为数量,小于此值时会根据贴片机信息自动出料"
)
@ApiModelProperty
(
"报警值,与贴片机连机时使用,值小于1时为初始数量amount百分比,大于等于1时为数量,小于此值时会根据贴片机信息自动出料"
)
private
float
alarmValue
=
0.5f
;
private
float
alarmValue
=
0.5f
;
@ApiModelProperty
(
"宽度"
)
private
int
plateSize
;
private
int
plateSize
;
@ApiModelProperty
(
"高度"
)
private
int
height
;
private
int
height
;
@ApiModelProperty
(
"单台料仓可存储此种物料的最大数量"
)
@ApiModelProperty
(
"单台料仓可存储此种物料的最大数量"
)
...
...
src/main/java/com/neotel/smfcore/core/storage/rest/StorageController.java
查看文件 @
70d19f0
...
@@ -19,6 +19,8 @@ import com.neotel.smfcore.core.storage.service.po.Storage;
...
@@ -19,6 +19,8 @@ import com.neotel.smfcore.core.storage.service.po.Storage;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
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.manager.IGroupManager
;
import
com.neotel.smfcore.security.service.po.Group
;
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
;
...
@@ -58,6 +60,8 @@ public class StorageController {
...
@@ -58,6 +60,8 @@ public class StorageController {
private
final
FileProperties
properties
;
private
final
FileProperties
properties
;
@Autowired
@Autowired
private
final
IStoragePosManager
storagePosManager
;
private
final
IStoragePosManager
storagePosManager
;
@Autowired
private
final
IGroupManager
groupManager
;
@Autowired
@Autowired
private
final
DataCache
dataCache
;
private
final
DataCache
dataCache
;
...
@@ -70,6 +74,16 @@ public class StorageController {
...
@@ -70,6 +74,16 @@ public class StorageController {
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
PageData
<
Storage
>
pages
=
storageManager
.
findByPage
(
query
,
pageable
);
PageData
<
Storage
>
pages
=
storageManager
.
findByPage
(
query
,
pageable
);
List
<
StorageDto
>
StorageDtos
=
storageMapper
.
toDto
(
pages
.
getContent
());
List
<
StorageDto
>
StorageDtos
=
storageMapper
.
toDto
(
pages
.
getContent
());
for
(
int
i
=
0
;
i
<
StorageDtos
.
size
();
i
++){
String
groupId
=
"1"
;
if
(
StorageDtos
.
get
(
i
).
getGroupId
()!=
null
&&(!
StorageDtos
.
get
(
i
).
getGroupId
().
isEmpty
())){
groupId
=
StorageDtos
.
get
(
i
).
getGroupId
();
}
Group
group
=
groupManager
.
get
(
groupId
);
if
(
group
!=
null
){
StorageDtos
.
get
(
i
).
setGroupName
(
group
.
getGroupName
());
}
}
return
new
PageData
(
StorageDtos
,
pages
.
getTotalElements
());
return
new
PageData
(
StorageDtos
,
pages
.
getTotalElements
());
}
}
@ApiOperation
(
"新增料仓"
)
@ApiOperation
(
"新增料仓"
)
...
@@ -166,6 +180,9 @@ public class StorageController {
...
@@ -166,6 +180,9 @@ public class StorageController {
if
(
storage
.
getSourcePath
()==
null
){
if
(
storage
.
getSourcePath
()==
null
){
storage
.
setSourcePath
(
""
);
storage
.
setSourcePath
(
""
);
}
}
if
(
storage
.
getGroupId
()==
null
||
storage
.
getGroupId
().
isEmpty
()){
storage
.
setGroupId
(
"1"
);
}
storage
=
storageDao
.
save
(
storage
);
storage
=
storageDao
.
save
(
storage
);
...
...
src/main/java/com/neotel/smfcore/core/storage/rest/dto/StorageDto.java
查看文件 @
70d19f0
...
@@ -52,4 +52,7 @@ public class StorageDto implements Serializable {
...
@@ -52,4 +52,7 @@ public class StorageDto implements Serializable {
@ApiModelProperty
(
"分组"
)
@ApiModelProperty
(
"分组"
)
private
String
groupId
=
""
;
private
String
groupId
=
""
;
@ApiModelProperty
(
"组名称"
)
private
String
groupName
=
""
;
}
}
src/main/java/com/neotel/smfcore/security/rest/UserController.java
查看文件 @
70d19f0
...
@@ -15,11 +15,17 @@
...
@@ -15,11 +15,17 @@
*/
*/
package
com
.
neotel
.
smfcore
.
security
.
rest
;
package
com
.
neotel
.
smfcore
.
security
.
rest
;
import
com.google.common.base.Strings
;
import
com.neotel.smfcore.common.annotation.QueryCondition
;
import
com.neotel.smfcore.common.annotation.QueryCondition
;
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.csv.CsvReader
;
import
com.neotel.smfcore.common.exception.BadRequestException
;
import
com.neotel.smfcore.common.exception.BadRequestException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.*
;
import
com.neotel.smfcore.common.utils.*
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.security.bean.FileProperties
;
import
com.neotel.smfcore.security.bean.RsaProperties
;
import
com.neotel.smfcore.security.bean.RsaProperties
;
import
com.neotel.smfcore.security.rest.bean.dto.RoleSmallDto
;
import
com.neotel.smfcore.security.rest.bean.dto.RoleSmallDto
;
import
com.neotel.smfcore.security.rest.bean.dto.UserDto
;
import
com.neotel.smfcore.security.rest.bean.dto.UserDto
;
...
@@ -28,6 +34,7 @@ import com.neotel.smfcore.security.rest.bean.query.UserQueryCriteria;
...
@@ -28,6 +34,7 @@ import com.neotel.smfcore.security.rest.bean.query.UserQueryCriteria;
import
com.neotel.smfcore.security.rest.bean.vo.UserPassVo
;
import
com.neotel.smfcore.security.rest.bean.vo.UserPassVo
;
import
com.neotel.smfcore.security.service.manager.IRoleManager
;
import
com.neotel.smfcore.security.service.manager.IRoleManager
;
import
com.neotel.smfcore.security.service.manager.IUserManager
;
import
com.neotel.smfcore.security.service.manager.IUserManager
;
import
com.neotel.smfcore.security.service.manager.impl.UserManagerImpl
;
import
com.neotel.smfcore.security.service.po.Role
;
import
com.neotel.smfcore.security.service.po.Role
;
import
com.neotel.smfcore.security.service.po.User
;
import
com.neotel.smfcore.security.service.po.User
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -43,8 +50,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
...
@@ -43,8 +50,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.*
;
...
@@ -67,6 +76,8 @@ public class UserController {
...
@@ -67,6 +76,8 @@ public class UserController {
@Autowired
@Autowired
private
IRoleManager
roleManager
;
private
IRoleManager
roleManager
;
@Autowired
private
final
FileProperties
properties
;
@ApiOperation
(
"导出用户数据"
)
@ApiOperation
(
"导出用户数据"
)
@GetMapping
(
value
=
"/download"
)
@GetMapping
(
value
=
"/download"
)
...
@@ -219,5 +230,88 @@ public class UserController {
...
@@ -219,5 +230,88 @@ public class UserController {
userManager
.
updateGroups
(
resources
);
userManager
.
updateGroups
(
resources
);
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
}
@ApiOperation
(
"上传用户列表"
)
@PostMapping
(
value
=
"/upload"
)
public
ResultBean
upload
(
@RequestParam
MultipartFile
uploadFile
)
throws
Exception
{
// 验证文件上传的格式
String
image
=
"csv"
;
String
fileType
=
FileUtil
.
getExtensionName
(
uploadFile
.
getOriginalFilename
());
if
(
fileType
!=
null
&&
!
image
.
contains
(
fileType
)){
throw
new
BadRequestException
(
"文件格式错误!, 仅支持 "
+
image
+
" 格式"
);
}
File
folder
=
new
File
(
properties
.
getPath
(),
"user"
);
File
file
=
FileUtil
.
upload
(
uploadFile
,
folder
.
getAbsolutePath
());
String
resultMsg
=
handleUserUpload
(
file
.
getAbsolutePath
());
return
ResultBean
.
newOkResult
(
resultMsg
);
}
private
int
getCsvIndex
(
CsvReader
csvReader
,
String
titleName
,
String
titleNameEn
){
int
index
=
csvReader
.
getIndex
(
titleName
,
titleNameEn
);
if
(
index
==
-
1
){
log
.
info
(
"未包含【"
+
titleName
+
"】或【"
+
titleNameEn
+
"】列"
);
throw
new
ValidateException
(
"必须包含["
+
titleNameEn
+
"]列"
);
}
return
index
;
}
protected
String
handleUserUpload
(
String
fileURL
)
throws
Exception
{
log
.
info
(
"开始更新用户列表"
);
CsvReader
csvRead
=
new
CsvReader
(
fileURL
);
csvRead
.
setSkipEmptyRecords
(
true
);
//忽略空行
csvRead
.
setTrimWhitespace
(
true
);
//去除空格
csvRead
.
readHeaders
();
int
idIndex
=
getCsvIndex
(
csvRead
,
"用户ID"
,
"ID"
);
int
usernameIndex
=
getCsvIndex
(
csvRead
,
"用户名"
,
"UserName"
);
int
codeIndex
=
getCsvIndex
(
csvRead
,
"启用码"
,
"CheckCode"
);
int
row
=
1
;
int
newRowCount
=
0
;
int
updateRowCount
=
0
;
String
msg
=
""
;
while
(
csvRead
.
readRecord
()){
row
++;
String
[]
lineValues
=
csvRead
.
getValues
();
String
id
=
lineValues
[
idIndex
];
String
checkCode
=
lineValues
[
codeIndex
];
String
username
=
lineValues
[
usernameIndex
];
if
(
checkCode
.
isEmpty
()
||
username
.
isEmpty
()
||
id
.
isEmpty
()){
log
.
warn
(
"第"
+
row
+
"行中有空白内容,此行忽略"
);
continue
;
}
User
user
=
userManager
.
get
(
id
);
if
(
user
!=
null
){
//判断是否已启用
if
(
user
.
getEnabled
()){
//判断验证码是否正确
String
code
=
Md5Utls
.
getMd5
(
id
,
user
.
getCreateDate
());
if
(
code
.
equals
(
user
.
getCheckCode
())){
//此用户已验证过,不需要在验证
}
else
if
(
code
.
equals
(
checkCode
)){
user
.
setCheckCode
(
checkCode
);
user
.
setEnabled
(
true
);
userManager
.
save
(
user
);
msg
+=
"["
+
user
.
getUsername
()+
"]"
;
}
}
else
{
String
code
=
Md5Utls
.
getMd5
(
id
,
user
.
getCreateDate
());
if
(
code
.
equals
(
checkCode
)){
user
.
setCheckCode
(
checkCode
);
user
.
setEnabled
(
true
);
userManager
.
save
(
user
);
msg
+=
"["
+
user
.
getUsername
()+
"]"
;
}
}
}
}
log
.
info
(
"上传用户,启用一下用户:"
+
msg
);
return
msg
;
}
}
}
src/main/java/com/neotel/smfcore/security/service/manager/impl/GroupManagerImpl.java
查看文件 @
70d19f0
...
@@ -59,6 +59,7 @@ public class GroupManagerImpl implements IGroupManager {
...
@@ -59,6 +59,7 @@ public class GroupManagerImpl implements IGroupManager {
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"组ID"
,
group
.
getId
());
map
.
put
(
"组ID"
,
group
.
getId
());
map
.
put
(
"组名称"
,
group
.
getGroupName
());
map
.
put
(
"组名称"
,
group
.
getGroupName
());
map
.
put
(
"创建时间"
,
group
.
getCreateDate
());
list
.
add
(
map
);
list
.
add
(
map
);
}
}
FileUtil
.
downloadExcel
(
list
,
response
);
FileUtil
.
downloadExcel
(
list
,
response
);
...
...
src/main/java/com/neotel/smfcore/security/service/manager/impl/UserManagerImpl.java
查看文件 @
70d19f0
...
@@ -148,11 +148,12 @@ public class UserManagerImpl implements IUserManager {
...
@@ -148,11 +148,12 @@ public class UserManagerImpl implements IUserManager {
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"用户ID"
,
user
.
getId
());
map
.
put
(
"用户ID"
,
user
.
getId
());
map
.
put
(
"用户名"
,
user
.
getUsername
());
map
.
put
(
"用户名"
,
user
.
getUsername
());
map
.
put
(
"角色"
,
user
.
getRoleId
());
//
map.put("角色", user.getRoleId());
map
.
put
(
"邮箱"
,
user
.
getEmail
());
map
.
put
(
"邮箱"
,
user
.
getEmail
());
map
.
put
(
"状态"
,
user
.
getEnabled
()
?
"启用"
:
"禁用"
);
map
.
put
(
"状态"
,
user
.
getEnabled
()
?
"启用"
:
"禁用"
);
map
.
put
(
"语言"
,
user
.
getLanguage
());
//
map.put("语言",user.getLanguage());
map
.
put
(
"创建日期"
,
user
.
getCreateDate
());
map
.
put
(
"创建日期"
,
user
.
getCreateDate
());
map
.
put
(
"启用码"
,
""
);
list
.
add
(
map
);
list
.
add
(
map
);
}
}
FileUtil
.
downloadExcel
(
list
,
response
);
FileUtil
.
downloadExcel
(
list
,
response
);
...
...
src/main/java/com/neotel/smfcore/security/service/po/Menu.java
查看文件 @
70d19f0
...
@@ -135,16 +135,11 @@ public class Menu extends BasePo implements Serializable {
...
@@ -135,16 +135,11 @@ public class Menu extends BasePo implements Serializable {
this
.
iFrame
=
false
;
this
.
iFrame
=
false
;
this
.
cache
=
false
;
this
.
cache
=
false
;
this
.
hidden
=
false
;
this
.
hidden
=
false
;
this
.
componentName
=
title
;
this
.
componentName
=
""
;
this
.
icon
=
icon
;
this
.
icon
=
icon
;
}
/**
}
* 此方法用于构建权限菜单,type=2
public
Menu
(
final
String
permission
,
final
String
title
,
final
Integer
menuSort
,
final
String
pid
)
{
* @param permission
* @param title
* @param menuSort
* @param pid
*/
public
Menu
(
final
String
permission
,
final
String
title
,
final
Integer
menuSort
,
final
String
pid
)
{
this
.
children
=
new
ArrayList
<
Menu
>();
this
.
children
=
new
ArrayList
<
Menu
>();
this
.
type
=
2
;
this
.
type
=
2
;
this
.
permission
=
permission
;
this
.
permission
=
permission
;
...
@@ -160,4 +155,19 @@ public class Menu extends BasePo implements Serializable {
...
@@ -160,4 +155,19 @@ public class Menu extends BasePo implements Serializable {
this
.
componentName
=
title
;
this
.
componentName
=
title
;
this
.
icon
=
""
;
this
.
icon
=
""
;
}
}
/**
* 此方法用于构建权限菜单,type=2
*/
public
static
Menu
CreatePerMenu
(
final
String
permission
,
final
String
title
,
final
String
pid
)
{
Menu
menu
=
new
Menu
(
new
ArrayList
<
Menu
>(),
2
,
permission
,
title
,
999
,
""
,
""
,
pid
,
0
,
false
,
false
,
false
,
""
,
""
);
return
menu
;
}
/**
* 此方法用户创建只用于显示的一级菜单,type=0
*/
public
static
Menu
CreatePMenu
(
final
String
title
,
final
Integer
menuSort
,
final
String
path
,
final
Integer
subCount
,
final
String
icon
)
{
Menu
menu
=
new
Menu
(
new
ArrayList
<
Menu
>(),
0
,
""
,
title
,
menuSort
,
path
,
""
,
""
,
subCount
,
false
,
false
,
false
,
title
,
icon
);
return
menu
;
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论