Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
李苗
/
Vion-DevOps
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e9d97a35
authored
Aug 21, 2024
by
HlQ
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[fix] 设备状态流转问题修改
1 parent
24057cc6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
26 deletions
src/main/java/vion/controller/DeviceController.java
src/main/java/vion/service/IDeviceService.java
src/main/java/vion/service/impl/IDeviceServiceImpl.java
src/main/java/vion/controller/DeviceController.java
View file @
e9d97a3
...
@@ -41,15 +41,15 @@ public class DeviceController {
...
@@ -41,15 +41,15 @@ public class DeviceController {
}
}
@PostMapping
(
"/single"
)
@PostMapping
(
"/single"
)
@SaCheckPermission
(
value
=
"device:
sav
e"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"device:
circulat
e"
,
orRole
=
"admin"
)
public
String
sav
e
(
@RequestBody
DeviceDTO
dto
)
{
public
String
circulat
e
(
@RequestBody
DeviceDTO
dto
)
{
return
deviceService
.
sav
e
(
dto
);
return
deviceService
.
circulat
e
(
dto
);
}
}
@PostMapping
(
"/batch"
)
@PostMapping
(
"/batch"
)
@SaCheckPermission
(
value
=
"device:
sav
eBatch"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"device:
circulat
eBatch"
,
orRole
=
"admin"
)
public
String
sav
eBatch
(
@RequestBody
List
<
DeviceDTO
>
dtoList
)
{
public
String
circulat
eBatch
(
@RequestBody
List
<
DeviceDTO
>
dtoList
)
{
return
deviceService
.
sav
eBatch
(
dtoList
);
return
deviceService
.
circulat
eBatch
(
dtoList
);
}
}
}
}
src/main/java/vion/service/IDeviceService.java
View file @
e9d97a3
...
@@ -20,7 +20,7 @@ public interface IDeviceService extends MPJBaseService<Device> {
...
@@ -20,7 +20,7 @@ public interface IDeviceService extends MPJBaseService<Device> {
String
update
(
List
<
DeviceDTO
>
dtoList
);
String
update
(
List
<
DeviceDTO
>
dtoList
);
String
sav
e
(
DeviceDTO
dto
);
String
circulat
e
(
DeviceDTO
dto
);
String
sav
eBatch
(
List
<
DeviceDTO
>
dtoList
);
String
circulat
eBatch
(
List
<
DeviceDTO
>
dtoList
);
}
}
src/main/java/vion/service/impl/IDeviceServiceImpl.java
View file @
e9d97a3
...
@@ -75,44 +75,40 @@ public class IDeviceServiceImpl extends MPJBaseServiceImpl<DeviceMapper, Device>
...
@@ -75,44 +75,40 @@ public class IDeviceServiceImpl extends MPJBaseServiceImpl<DeviceMapper, Device>
}
}
@Override
@Override
public
String
sav
e
(
DeviceDTO
dto
)
{
public
String
circulat
e
(
DeviceDTO
dto
)
{
// 只有出库才允许单个设备录入
// 只有出库才允许单个设备录入
if
(
ObjUtil
.
notEquals
(
dto
.
getStatus
(),
2
))
{
if
(
ObjUtil
.
notEquals
(
dto
.
getStatus
(),
2
))
{
return
"该设备状态限制,不支持录入"
;
return
"该设备状态限制,不支持录入"
;
}
}
var
device
=
converter
.
convert
(
dto
,
Device
.
class
);
var
device
=
converter
.
convert
(
dto
,
Device
.
class
);
if
(
this
.
save
(
device
))
{
if
(
this
.
updateById
(
device
))
{
var
deviceLog
=
new
DeviceLog
();
var
deviceLog
=
new
DeviceLog
();
deviceLog
.
setDeviceId
(
device
.
getId
());
deviceLog
.
setDeviceId
(
device
.
getId
());
deviceLog
.
setOperator
(
dto
.
getUserId
());
deviceLog
.
setOperator
(
dto
.
getUserId
());
deviceLog
.
setContent
(
getStatusStr
(
dto
.
getStatus
()));
deviceLog
.
setContent
(
getStatusStr
(
dto
.
getStatus
()));
deviceLogService
.
save
(
deviceLog
);
deviceLogService
.
save
(
deviceLog
);
return
"
保存
成功"
;
return
"
出库
成功"
;
}
}
return
"
保存
失败"
;
return
"
出库
失败"
;
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
sav
eBatch
(
List
<
DeviceDTO
>
dtoList
)
{
public
String
circulat
eBatch
(
List
<
DeviceDTO
>
dtoList
)
{
if
(
CollUtil
.
isEmpty
(
dtoList
))
{
if
(
CollUtil
.
isEmpty
(
dtoList
))
{
return
"录入设备为空"
;
return
"录入设备为空"
;
}
}
var
userId
=
dtoList
.
getFirst
().
getUserId
();
var
userId
=
dtoList
.
getFirst
().
getUserId
();
var
deviceList
=
converter
.
convert
(
dtoList
,
Device
.
class
);
var
deviceList
=
converter
.
convert
(
dtoList
,
Device
.
class
);
if
(
this
.
saveBatch
(
deviceList
))
{
deviceList
.
forEach
(
d
->
{
var
logList
=
deviceList
.
stream
()
this
.
lambdaUpdate
().
eq
(
Device:
:
getSerialNum
,
d
.
getSerialNum
()).
update
(
d
);
.
map
(
d
->
{
var
deviceLog
=
new
DeviceLog
();
var
deviceLog
=
new
DeviceLog
();
deviceLog
.
setDeviceId
(
d
.
getId
());
deviceLog
.
setDeviceId
(
d
.
getId
());
deviceLog
.
setOperator
(
userId
);
deviceLog
.
setOperator
(
userId
);
deviceLog
.
setContent
(
getStatusStr
(
d
.
getStatus
()));
deviceLog
.
setContent
(
getStatusStr
(
d
.
getStatus
()));
deviceLogService
.
save
(
deviceLog
);
return
deviceLog
;
});
}).
toList
();
return
"保存成功"
;
deviceLogService
.
saveBatch
(
logList
);
return
"保存成功"
;
}
return
"保存失败"
;
}
}
private
String
getStatusStr
(
Integer
status
)
{
private
String
getStatusStr
(
Integer
status
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment