Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
e0dcf3b0
Commit
e0dcf3b0
authored
Nov 09, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改开门操作为Service
parent
9a99cf75
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
32 deletions
+18
-32
SOrderController.java
...in/java/share/web/controller/system/SOrderController.java
+2
-9
SRoomController.java
...ain/java/share/web/controller/system/SRoomController.java
+2
-10
ISOrderService.java
...em/src/main/java/share/system/service/ISOrderService.java
+1
-2
ISRoomService.java
...tem/src/main/java/share/system/service/ISRoomService.java
+1
-1
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+1
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+6
-7
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+5
-3
No files found.
share-front/src/main/java/share/web/controller/system/SOrderController.java
View file @
e0dcf3b0
...
...
@@ -13,7 +13,6 @@ import share.common.core.domain.AjaxResult;
import
share.common.core.domain.R
;
import
share.common.core.redis.RedisUtil
;
import
share.common.utils.JsonConvertUtil
;
import
share.framework.mqtt.MqttGatewayComponent
;
import
share.system.domain.SOrder
;
import
share.system.domain.vo.SOrderVo
;
import
share.system.domain.vo.MqttxVo
;
...
...
@@ -45,8 +44,6 @@ public class SOrderController extends BaseController
@Autowired
private
RedisUtil
redisUtil
;
@Autowired
private
MqttGatewayComponent
mqttGatewayComponent
;
@Autowired
private
DeviceLogService
deviceLogService
;
/**
...
...
@@ -92,12 +89,8 @@ public class SOrderController extends BaseController
*/
@ApiOperation
(
value
=
"开门"
)
@RequestMapping
(
value
=
"/open/door"
,
method
=
RequestMethod
.
POST
)
public
R
<
Integer
>
openDoor
(
@RequestBody
String
orderNo
)
{
MqttxVo
mqttxVo
=
sOrderService
.
openDoor
(
orderNo
);
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
int
result
=
deviceLogService
.
addDeviceLog
(
mqttxVo
);
return
R
.
ok
(
result
);
public
R
<
String
>
openDoor
(
@RequestBody
String
orderNo
)
{
return
R
.
ok
(
sOrderService
.
openDoor
(
orderNo
));
}
/**
...
...
share-front/src/main/java/share/web/controller/system/SRoomController.java
View file @
e0dcf3b0
...
...
@@ -9,10 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.R
;
import
share.framework.mqtt.MqttGatewayComponent
;
import
share.system.domain.SPack
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.domain.vo.RoomStatusVo
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.service.DeviceLogService
;
...
...
@@ -40,8 +38,6 @@ public class SRoomController extends BaseController {
@Autowired
private
IPackService
packService
;
@Autowired
private
MqttGatewayComponent
mqttGatewayComponent
;
@Autowired
private
DeviceLogService
deviceLogService
;
/**
...
...
@@ -86,12 +82,8 @@ public class SRoomController extends BaseController {
*/
@ApiOperation
(
value
=
"专属保洁的开门操作"
)
@RequestMapping
(
value
=
"/open/door"
,
method
=
RequestMethod
.
POST
)
public
R
<
Integer
>
openDoor
(
@RequestBody
Long
id
)
{
MqttxVo
mqttxVo
=
sRoomService
.
openDoor
(
id
);
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
int
result
=
deviceLogService
.
addDeviceLog
(
mqttxVo
);
return
R
.
ok
(
result
);
public
R
<
String
>
openDoor
(
@RequestBody
Long
id
)
{
return
R
.
ok
(
sRoomService
.
openDoor
(
id
));
}
/**
...
...
share-system/src/main/java/share/system/service/ISOrderService.java
View file @
e0dcf3b0
...
...
@@ -6,7 +6,6 @@ import java.util.List;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.SOrder
;
import
share.system.domain.vo.SOrderVo
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.request.CreateOrderRequest
;
import
share.system.request.OrderComputedPriceRequest
;
import
share.system.request.OrderRefundRequest
;
...
...
@@ -99,7 +98,7 @@ public interface ISOrderService extends IService<SOrder>
*/
SOrder
getByOrderNo
(
String
orderNo
);
MqttxVo
openDoor
(
String
orderNo
);
String
openDoor
(
String
orderNo
);
SOrder
getInfoByEntity
(
SOrder
orderParam
);
...
...
share-system/src/main/java/share/system/service/ISRoomService.java
View file @
e0dcf3b0
...
...
@@ -85,7 +85,7 @@ public interface ISRoomService extends IService<SRoom>
List
<
SRoom
>
selectSroomListByStroeId
(
Long
storeId
);
MqttxVo
openDoor
(
Long
id
);
String
openDoor
(
Long
id
);
List
<
SPack
>
getPackByRoomId
(
Long
id
);
...
...
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
e0dcf3b0
...
...
@@ -30,6 +30,7 @@ import share.system.service.ISConsumerCouponService;
import
share.system.service.ISCouponService
;
import
share.system.service.QPService
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
e0dcf3b0
...
...
@@ -22,7 +22,6 @@ import share.common.utils.DateUtil;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.utils.SecurityUtils
;
import
share.common.utils.bean.BeanUtils
;
import
share.system.domain.*
;
import
share.system.domain.vo.FrontTokenComponent
;
...
...
@@ -78,10 +77,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
private
RedisUtil
redisUtil
;
@Autowired
private
MqttxService
mqttx
Service
;
private
DeviceService
device
Service
;
@Autowired
private
Device
Service
device
Service
;
private
Device
OpService
deviceOp
Service
;
/**
* 查询订单
...
...
@@ -416,7 +415,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
}
@Override
public
MqttxVo
openDoor
(
String
orderNo
)
{
public
String
openDoor
(
String
orderNo
)
{
SOrder
sOrder
=
sOrderMapper
.
selectSOrderByNo
(
orderNo
);
if
(
Objects
.
isNull
(
sOrder
))
{
throw
new
BaseException
(
"订单不存在!"
);
...
...
@@ -431,8 +430,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
if
(
Objects
.
isNull
(
one
))
{
throw
new
BaseException
(
"设备不存在!"
);
}
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
one
.
getDevId
(),
user
.
getNickName
(),
"10"
);
if
(
sOrder
.
getStatus
().
equals
(
OrderStatusEnum
.
UNUSED
.
getCode
()))
{
//更改订单状态,房间状态,开始时间,结束时间
sOrder
.
setStatus
(
1
);
...
...
@@ -443,7 +440,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
sOrder
.
setEndDate
(
DateUtils
.
addHours
(
new
Date
(),
bigDecimal
.
intValue
()));
sOrderMapper
.
updateById
(
sOrder
);
}
return
mqttxVo
;
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
user
.
getNickName
());
return
"开锁成功"
;
}
private
BigDecimal
computeTotalPrice
(
BigDecimal
unitPrice
,
Date
startTime
,
Date
endTime
){
...
...
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
e0dcf3b0
...
...
@@ -45,6 +45,8 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
private
DeviceService
deviceService
;
@Autowired
private
MqttxService
mqttxService
;
@Autowired
private
DeviceOpService
deviceOpService
;
/**
...
...
@@ -217,7 +219,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
}
@Override
public
MqttxVo
openDoor
(
Long
id
)
{
public
String
openDoor
(
Long
id
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
if
(!
user
.
getRoleType
().
equals
(
RoleTypeEnum
.
CLEANER
.
getCode
()))
{
throw
new
RuntimeException
(
"当前用户不是保洁人员"
);
...
...
@@ -232,8 +234,8 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
if
(
Objects
.
isNull
(
one
))
{
throw
new
BaseException
(
"设备不存在!"
);
}
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
one
.
getDevId
(),
user
.
getNickName
(),
"10"
);
return
mqttxVo
;
deviceOpService
.
openDoor
(
id
,
user
.
getNickName
()
);
return
"开锁成功"
;
}
@Override
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment