Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 89c27dc1
由
LN
编写于
2021-07-23 13:47:32 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加条码设置
1 个父辈
936d72c1
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
113 行增加
和
27 行删除
src/main/java/com/neotel/smfcore/core/barcode/rest/BacodeController.java
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/dto/BarcodeSettingDto.java
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/dto/ComponentDto.java
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/mapstruct/BarcodeSettingMapper.java
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/query/ComponentQueryCriteria.java
src/main/java/com/neotel/smfcore/security/rest/GroupController.java
src/main/java/com/neotel/smfcore/security/rest/MenuController.java
src/main/java/com/neotel/smfcore/security/rest/RoleController.java
src/main/java/com/neotel/smfcore/security/rest/UserController.java
src/main/java/com/neotel/smfcore/core/barcode/rest/BacodeController.java
查看文件 @
89c27dc
...
@@ -4,16 +4,14 @@ import com.neotel.smfcore.common.bean.PageData;
...
@@ -4,16 +4,14 @@ import com.neotel.smfcore.common.bean.PageData;
import
com.neotel.smfcore.common.exception.BadRequestException
;
import
com.neotel.smfcore.common.exception.BadRequestException
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeSettingDto
;
import
com.neotel.smfcore.core.barcode.rest.bean.mapstruct.BarcodeMapper
;
import
com.neotel.smfcore.core.barcode.rest.bean.mapstruct.BarcodeMapper
;
import
com.neotel.smfcore.core.barcode.rest.bean.mapstruct.BarcodeSettingMapper
;
import
com.neotel.smfcore.core.barcode.rest.bean.query.BarcodeQueryCriteria
;
import
com.neotel.smfcore.core.barcode.rest.bean.query.BarcodeQueryCriteria
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Component
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.security.rest.bean.dto.RoleDto
;
import
com.neotel.smfcore.core.system.service.po.Settings
;
import
com.neotel.smfcore.security.rest.bean.dto.UserDto
;
import
com.neotel.smfcore.security.rest.bean.query.RoleQueryCriteria
;
import
com.neotel.smfcore.security.service.po.Role
;
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
;
...
@@ -43,6 +41,10 @@ public class BacodeController {
...
@@ -43,6 +41,10 @@ public class BacodeController {
private
final
IBarcodeManager
barcodeManager
;
private
final
IBarcodeManager
barcodeManager
;
@Autowired
@Autowired
private
final
BarcodeMapper
barcodeMapper
;
private
final
BarcodeMapper
barcodeMapper
;
@Autowired
private
final
BarcodeSettingMapper
barcodeSettingMapper
;
@Autowired
private
final
DataCache
dataCache
;
@ApiOperation
(
"导出条码数据"
)
@ApiOperation
(
"导出条码数据"
)
@GetMapping
(
value
=
"/download"
)
@GetMapping
(
value
=
"/download"
)
...
@@ -97,4 +99,34 @@ public class BacodeController {
...
@@ -97,4 +99,34 @@ public class BacodeController {
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
}
@ApiOperation
(
"获取条码设置信息"
)
@GetMapping
(
"/setting"
)
@PreAuthorize
(
"@el.check('barcode:setting')"
)
public
BarcodeSettingDto
setting
(){
BarcodeSettingDto
settingDto
=
barcodeSettingMapper
.
toDto
(
dataCache
.
getSettings
()
);
return
settingDto
;
}
@ApiOperation
(
"修改条码设置信息"
)
@PutMapping
(
"/setting"
)
@PreAuthorize
(
"@el.check('barcode:setting')"
)
public
ResponseEntity
<
Object
>
updateSetting
(
@Validated
@RequestBody
BarcodeSettingDto
settingDto
)
{
if
(
settingDto
.
getCodeRuleList
().
isEmpty
()){
throw
new
BadRequestException
(
"条码规则不能为空"
);
}
if
(
settingDto
.
getPageHeight
()==
null
){
throw
new
BadRequestException
(
"纸张高度不能为空"
);
}
if
(
settingDto
.
getPageWidth
()==
null
){
throw
new
BadRequestException
(
"纸张宽度不能为空"
);
}
Settings
settings
=
dataCache
.
getSettings
();
settings
.
setCodeRuleList
(
settingDto
.
getCodeRuleList
());
settings
.
setPageHeight
(
settingDto
.
getPageHeight
());
settings
.
setPageWidth
(
settingDto
.
getPageWidth
());
dataCache
.
updateSettings
(
settings
);
//修改设置
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
}
}
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/dto/BarcodeSettingDto.java
0 → 100644
查看文件 @
89c27dc
package
com
.
neotel
.
smfcore
.
core
.
barcode
.
rest
.
bean
.
dto
;
import
com.google.common.collect.Lists
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.models.auth.In
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
@Getter
@Setter
public
class
BarcodeSettingDto
{
/**
* 多条条码规则
*/
@ApiModelProperty
(
"多条条码规则"
)
private
List
<
String
>
codeRuleList
=
Lists
.
newArrayList
();
/**
* 打印条码的纸张宽度(条码为方形,大小是长宽中最小的)
*/
@ApiModelProperty
(
"打印条码的纸张宽度(条码为方形,大小是长宽中最小的)"
)
private
Integer
pageWidth
=
500
;
/**
* 打印条码的纸张高度
*/
@ApiModelProperty
(
"打印条码的纸张高度"
)
private
Integer
pageHeight
=
160
;
}
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/dto/ComponentDto.java
查看文件 @
89c27dc
...
@@ -12,7 +12,7 @@ public class ComponentDto implements Serializable {
...
@@ -12,7 +12,7 @@ public class ComponentDto implements Serializable {
/**
/**
* 产品类型:0元器件,1锡膏2PCB3其他4夹具
* 产品类型:0元器件,1锡膏2PCB3其他4夹具
*/
*/
@ApiModelProperty
(
"产品类型:0
元器件,1锡膏2PCB3其他4
夹具"
)
@ApiModelProperty
(
"产品类型:0
=元器件,1=锡膏,2=PCB,3=其他,4=
夹具"
)
private
int
type
=
COMPONENT_TYPE
.
COMPONENT
;
private
int
type
=
COMPONENT_TYPE
.
COMPONENT
;
/**
/**
...
@@ -76,20 +76,14 @@ public class ComponentDto implements Serializable {
...
@@ -76,20 +76,14 @@ public class ComponentDto implements Serializable {
开封后可以保存时间 室温最多存储时间-回温时间,第一次出库,就认为是开封
开封后可以保存时间 室温最多存储时间-回温时间,第一次出库,就认为是开封
*/
*/
//名称
@ApiModelProperty
(
"名称"
)
private
String
name
;
private
String
name
;
//料号
//@NotEmpty(message = "{component.partNumber.empty}")
// @NotEmpty(message = "{component.partNumber.empty}")
@ApiModelProperty
(
"料号"
)
// @NotNull
private
String
partNumber
;
private
String
partNumber
;
/**
@ApiModelProperty
(
"供应商PN,用于扫码贴标机转换PN"
)
* 供应商PN,用于扫码贴标机转换PN
*/
// private String supplierPn;
//uid
private
String
uid
;
private
String
uid
;
//物料描述
//物料描述
...
...
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/mapstruct/BarcodeSettingMapper.java
0 → 100644
查看文件 @
89c27dc
package
com
.
neotel
.
smfcore
.
core
.
barcode
.
rest
.
bean
.
mapstruct
;
import
com.neotel.smfcore.common.base.BaseMapper
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeSettingDto
;
import
com.neotel.smfcore.core.system.service.po.Settings
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.ReportingPolicy
;
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
BarcodeSettingMapper
extends
BaseMapper
<
BarcodeSettingDto
,
Settings
>
{
}
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/query/ComponentQueryCriteria.java
查看文件 @
89c27dc
...
@@ -2,6 +2,8 @@ package com.neotel.smfcore.core.barcode.rest.bean.query;
...
@@ -2,6 +2,8 @@ package com.neotel.smfcore.core.barcode.rest.bean.query;
import
com.neotel.smfcore.common.annotation.QueryCondition
;
import
com.neotel.smfcore.common.annotation.QueryCondition
;
import
com.neotel.smfcore.common.bean.BetweenData
;
import
com.neotel.smfcore.common.bean.BetweenData
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.format.annotation.DateTimeFormat
;
...
@@ -33,4 +35,7 @@ public class ComponentQueryCriteria {
...
@@ -33,4 +35,7 @@ public class ComponentQueryCriteria {
private
String
encapsulation
;
private
String
encapsulation
;
@QueryCondition
@QueryCondition
private
String
description
;
private
String
description
;
@ApiModelProperty
(
"产品类型:0=元器件,1=锡膏,2=PCB,3=其他,4=夹具"
)
@QueryCondition
private
Integer
type
;
}
}
src/main/java/com/neotel/smfcore/security/rest/GroupController.java
查看文件 @
89c27dc
...
@@ -84,7 +84,8 @@ public class GroupController {
...
@@ -84,7 +84,8 @@ public class GroupController {
@ApiOperation
(
"新增分组"
)
@ApiOperation
(
"新增分组"
)
@PostMapping
@PostMapping
@PreAuthorize
(
"@el.check('group:add')"
)
@PreAuthorize
(
"@el.check('group:add')"
)
public
ResponseEntity
<
Object
>
create
(
@RequestBody
Group
resources
)
{
public
ResponseEntity
<
Object
>
create
(
@RequestBody
GroupDto
groupDto
)
{
Group
resources
=
groupMapper
.
toEntity
(
groupDto
);
groupManager
.
saveGroup
(
resources
);
groupManager
.
saveGroup
(
resources
);
return
new
ResponseEntity
<>(
HttpStatus
.
CREATED
);
return
new
ResponseEntity
<>(
HttpStatus
.
CREATED
);
}
}
...
@@ -92,7 +93,8 @@ public class GroupController {
...
@@ -92,7 +93,8 @@ public class GroupController {
@ApiOperation
(
"修改分组"
)
@ApiOperation
(
"修改分组"
)
@PutMapping
@PutMapping
@PreAuthorize
(
"@el.check('group:edit')"
)
@PreAuthorize
(
"@el.check('group:edit')"
)
public
ResponseEntity
<
Object
>
update
(
@RequestBody
Group
resources
)
{
public
ResponseEntity
<
Object
>
update
(
@RequestBody
GroupDto
groupDto
)
{
Group
resources
=
groupMapper
.
toEntity
(
groupDto
);
if
(
resources
.
getId
()
==
null
)
{
if
(
resources
.
getId
()
==
null
)
{
throw
new
BadRequestException
(
"新增分组: 组ID不能为空"
);
throw
new
BadRequestException
(
"新增分组: 组ID不能为空"
);
}
}
...
...
src/main/java/com/neotel/smfcore/security/rest/MenuController.java
查看文件 @
89c27dc
...
@@ -143,7 +143,8 @@ public class MenuController {
...
@@ -143,7 +143,8 @@ public class MenuController {
@ApiOperation
(
"新增菜单"
)
@ApiOperation
(
"新增菜单"
)
@PostMapping
@PostMapping
@PreAuthorize
(
"@el.check('menu:add')"
)
@PreAuthorize
(
"@el.check('menu:add')"
)
public
ResponseEntity
<
Object
>
create
(
@Validated
@RequestBody
Menu
resources
)
{
public
ResponseEntity
<
Object
>
create
(
@Validated
@RequestBody
MenuDto
menuDto
)
{
Menu
resources
=
menuMapper
.
toEntity
(
menuDto
);
menuManager
.
saveMenu
(
resources
);
menuManager
.
saveMenu
(
resources
);
return
new
ResponseEntity
<>(
HttpStatus
.
CREATED
);
return
new
ResponseEntity
<>(
HttpStatus
.
CREATED
);
}
}
...
@@ -152,7 +153,8 @@ public class MenuController {
...
@@ -152,7 +153,8 @@ public class MenuController {
@ApiOperation
(
"修改菜单"
)
@ApiOperation
(
"修改菜单"
)
@PutMapping
@PutMapping
@PreAuthorize
(
"@el.check('menu:edit')"
)
@PreAuthorize
(
"@el.check('menu:edit')"
)
public
ResponseEntity
<
Object
>
update
(
@Validated
@RequestBody
Menu
resources
)
{
public
ResponseEntity
<
Object
>
update
(
@Validated
@RequestBody
MenuDto
menuDto
)
{
Menu
resources
=
menuMapper
.
toEntity
(
menuDto
);
if
(
resources
.
getId
()
==
null
)
{
if
(
resources
.
getId
()
==
null
)
{
throw
new
BadRequestException
(
" 修改菜单 :ID不能为空"
);
throw
new
BadRequestException
(
" 修改菜单 :ID不能为空"
);
}
}
...
...
src/main/java/com/neotel/smfcore/security/rest/RoleController.java
查看文件 @
89c27dc
...
@@ -91,7 +91,8 @@ public class RoleController {
...
@@ -91,7 +91,8 @@ public class RoleController {
@ApiOperation
(
"新增角色"
)
@ApiOperation
(
"新增角色"
)
@PostMapping
@PostMapping
@PreAuthorize
(
"@el.check('roles:add')"
)
@PreAuthorize
(
"@el.check('roles:add')"
)
public
ResponseEntity
<
Object
>
create
(
@Validated
@RequestBody
Role
resources
)
{
public
ResponseEntity
<
Object
>
create
(
@Validated
@RequestBody
RoleDto
roleDto
)
{
Role
resources
=
roleMapper
.
toEntity
(
roleDto
);
roleManager
.
saveRole
(
resources
);
roleManager
.
saveRole
(
resources
);
return
new
ResponseEntity
<>(
HttpStatus
.
CREATED
);
return
new
ResponseEntity
<>(
HttpStatus
.
CREATED
);
}
}
...
@@ -99,7 +100,8 @@ public class RoleController {
...
@@ -99,7 +100,8 @@ public class RoleController {
@ApiOperation
(
"修改角色"
)
@ApiOperation
(
"修改角色"
)
@PutMapping
@PutMapping
@PreAuthorize
(
"@el.check('roles:edit')"
)
@PreAuthorize
(
"@el.check('roles:edit')"
)
public
ResponseEntity
<
Object
>
update
(
@Validated
@RequestBody
Role
resources
)
{
public
ResponseEntity
<
Object
>
update
(
@Validated
@RequestBody
RoleDto
roleDto
)
{
Role
resources
=
roleMapper
.
toEntity
(
roleDto
);
if
(
resources
.
getId
()
==
null
)
{
if
(
resources
.
getId
()
==
null
)
{
throw
new
BadRequestException
(
"修改角色:ID不能为空"
);
throw
new
BadRequestException
(
"修改角色:ID不能为空"
);
...
@@ -111,7 +113,8 @@ public class RoleController {
...
@@ -111,7 +113,8 @@ public class RoleController {
@ApiOperation
(
"修改角色菜单"
)
@ApiOperation
(
"修改角色菜单"
)
@PutMapping
(
value
=
"/menu"
)
@PutMapping
(
value
=
"/menu"
)
@PreAuthorize
(
"@el.check('roles:edit')"
)
@PreAuthorize
(
"@el.check('roles:edit')"
)
public
ResponseEntity
<
Object
>
updateMenu
(
@RequestBody
Role
resources
)
{
public
ResponseEntity
<
Object
>
updateMenu
(
@RequestBody
RoleDto
roleDto
)
{
Role
resources
=
roleMapper
.
toEntity
(
roleDto
);
if
(
resources
.
getId
()
==
null
)
{
if
(
resources
.
getId
()
==
null
)
{
throw
new
BadRequestException
(
"修改角色菜单:ID不能为空"
);
throw
new
BadRequestException
(
"修改角色菜单:ID不能为空"
);
}
}
...
...
src/main/java/com/neotel/smfcore/security/rest/UserController.java
查看文件 @
89c27dc
...
@@ -143,7 +143,8 @@ public class UserController {
...
@@ -143,7 +143,8 @@ public class UserController {
@ApiOperation
(
"修改用户:个人中心"
)
@ApiOperation
(
"修改用户:个人中心"
)
@PutMapping
(
value
=
"center"
)
@PutMapping
(
value
=
"center"
)
// public ResponseEntity<Object> center(@Validated(User.Update.class) @RequestBody User resources){
// public ResponseEntity<Object> center(@Validated(User.Update.class) @RequestBody User resources){
public
ResponseEntity
<
Object
>
center
(
@Validated
@RequestBody
User
resources
)
{
public
ResponseEntity
<
Object
>
center
(
@Validated
@RequestBody
UserDto
userDto
)
{
User
resources
=
userMapper
.
toEntity
(
userDto
);
if
(!
resources
.
getId
().
equals
(
SecurityUtils
.
getCurrentUserId
()))
{
if
(!
resources
.
getId
().
equals
(
SecurityUtils
.
getCurrentUserId
()))
{
throw
new
BadRequestException
(
"不能修改他人资料"
);
throw
new
BadRequestException
(
"不能修改他人资料"
);
}
}
...
@@ -191,7 +192,8 @@ public class UserController {
...
@@ -191,7 +192,8 @@ public class UserController {
@ApiOperation
(
"修改邮箱"
)
@ApiOperation
(
"修改邮箱"
)
@PostMapping
(
value
=
"/updateEmail/{code}"
)
@PostMapping
(
value
=
"/updateEmail/{code}"
)
public
ResponseEntity
<
Object
>
updateEmail
(
@PathVariable
String
code
,
@RequestBody
User
user
)
throws
Exception
{
public
ResponseEntity
<
Object
>
updateEmail
(
@PathVariable
String
code
,
@RequestBody
UserDto
userDto
)
throws
Exception
{
User
user
=
userMapper
.
toEntity
(
userDto
);
String
password
=
RsaUtils
.
decryptByPrivateKey
(
RsaProperties
.
privateKey
,
user
.
getPassword
());
String
password
=
RsaUtils
.
decryptByPrivateKey
(
RsaProperties
.
privateKey
,
user
.
getPassword
());
User
myUser
=
userManager
.
findByUserName
(
SecurityUtils
.
getCurrentUsername
());
User
myUser
=
userManager
.
findByUserName
(
SecurityUtils
.
getCurrentUsername
());
if
(!
passwordEncoder
.
matches
(
password
,
myUser
.
getPassword
()))
{
if
(!
passwordEncoder
.
matches
(
password
,
myUser
.
getPassword
()))
{
...
@@ -204,7 +206,8 @@ public class UserController {
...
@@ -204,7 +206,8 @@ public class UserController {
@ApiOperation
(
"修改用户组"
)
@ApiOperation
(
"修改用户组"
)
@PutMapping
(
value
=
"/updateGroup"
)
@PutMapping
(
value
=
"/updateGroup"
)
@PreAuthorize
(
"@el.check('user:edit')"
)
@PreAuthorize
(
"@el.check('user:edit')"
)
public
ResponseEntity
<
Object
>
updateGroup
(
@RequestBody
User
resources
)
{
public
ResponseEntity
<
Object
>
updateGroup
(
@RequestBody
UserDto
userDto
)
{
User
resources
=
userMapper
.
toEntity
(
userDto
);
if
(
resources
.
getId
()
==
null
)
{
if
(
resources
.
getId
()
==
null
)
{
throw
new
BadRequestException
(
"修改用户组:ID不能为空"
);
throw
new
BadRequestException
(
"修改用户组:ID不能为空"
);
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论